Skip to content

Commit

Permalink
Stop generating errors for body inheritance (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored Dec 12, 2024
1 parent ea3e9b6 commit ae611bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 86 deletions.
5 changes: 0 additions & 5 deletions compiler/src/steps/validate-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
context.pop()

context.push('body')
if (typeDef.inherits != null && typeDef.body.kind !== 'properties') {
if (fqn(typeDef.inherits.type) !== '_types:RequestBase') {
modelError('A request with inherited properties must have a PropertyBody')
}
}
switch (typeDef.body.kind) {
case 'properties':
validateProperties(typeDef.body.properties, openGenerics, inheritedProps)
Expand Down
100 changes: 19 additions & 81 deletions output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,44 +62,27 @@
],
"response": []
},
"cat.aliases": {
"request": [
"request definition cat.aliases:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.allocation": {
"request": [
"request definition cat.allocation:Request / body - A request with inherited properties must have a PropertyBody"
],
"request": [],
"response": [
"type_alias definition _spec_utils:Stringified / union_of / instance_of - No type definition for '_spec_utils.Stringified:T'"
]
},
"cat.component_templates": {
"request": [
"request definition cat.component_templates:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.count": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.count:Request / body - A request with inherited properties must have a PropertyBody"
"Request: query parameter 'master_timeout' does not exist in the json spec"
],
"response": []
},
"cat.fielddata": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.fielddata:Request / body - A request with inherited properties must have a PropertyBody"
"Request: query parameter 'master_timeout' does not exist in the json spec"
],
"response": []
},
"cat.health": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.health:Request / body - A request with inherited properties must have a PropertyBody"
"Request: query parameter 'master_timeout' does not exist in the json spec"
],
"response": []
},
Expand All @@ -108,47 +91,31 @@
"Request: query parameter 'format' does not exist in the json spec",
"Request: query parameter 'h' does not exist in the json spec",
"Request: query parameter 'master_timeout' does not exist in the json spec",
"Request: query parameter 'v' does not exist in the json spec",
"request definition cat.help:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.indices": {
"request": [
"request definition cat.indices:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.master": {
"request": [
"request definition cat.master:Request / body - A request with inherited properties must have a PropertyBody"
"Request: query parameter 'v' does not exist in the json spec"
],
"response": []
},
"cat.ml_data_frame_analytics": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.ml_data_frame_analytics:Request / query - Property 'h' is already defined in an ancestor class",
"request definition cat.ml_data_frame_analytics:Request / query - Property 's' is already defined in an ancestor class",
"request definition cat.ml_data_frame_analytics:Request / body - A request with inherited properties must have a PropertyBody"
"request definition cat.ml_data_frame_analytics:Request / query - Property 's' is already defined in an ancestor class"
],
"response": []
},
"cat.ml_datafeeds": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.ml_datafeeds:Request / query - Property 'h' is already defined in an ancestor class",
"request definition cat.ml_datafeeds:Request / query - Property 's' is already defined in an ancestor class",
"request definition cat.ml_datafeeds:Request / body - A request with inherited properties must have a PropertyBody"
"request definition cat.ml_datafeeds:Request / query - Property 's' is already defined in an ancestor class"
],
"response": []
},
"cat.ml_jobs": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.ml_jobs:Request / query - Property 'h' is already defined in an ancestor class",
"request definition cat.ml_jobs:Request / query - Property 's' is already defined in an ancestor class",
"request definition cat.ml_jobs:Request / body - A request with inherited properties must have a PropertyBody"
"request definition cat.ml_jobs:Request / query - Property 's' is already defined in an ancestor class"
],
"response": []
},
Expand All @@ -157,73 +124,58 @@
"Request: query parameter 'master_timeout' does not exist in the json spec",
"Request: missing json spec query parameter 'time'",
"request definition cat.ml_trained_models:Request / query - Property 'h' is already defined in an ancestor class",
"request definition cat.ml_trained_models:Request / query - Property 's' is already defined in an ancestor class",
"request definition cat.ml_trained_models:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.nodeattrs": {
"request": [
"request definition cat.nodeattrs:Request / body - A request with inherited properties must have a PropertyBody"
"request definition cat.ml_trained_models:Request / query - Property 's' is already defined in an ancestor class"
],
"response": []
},
"cat.nodes": {
"request": [
"Request: missing json spec query parameter 'time'",
"request definition cat.nodes:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
"cat.pending_tasks": {
"request": [
"Request: missing json spec query parameter 'time'",
"request definition cat.pending_tasks:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
"cat.plugins": {
"request": [
"Request: missing json spec query parameter 'include_bootstrap'",
"request definition cat.plugins:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'include_bootstrap'"
],
"response": []
},
"cat.recovery": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"Request: missing json spec query parameter 'index'",
"Request: missing json spec query parameter 'time'",
"request definition cat.recovery:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
"cat.repositories": {
"request": [
"Request: missing json spec query parameter 'local'",
"request definition cat.repositories:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'local'"
],
"response": []
},
"cat.segments": {
"request": [
"Request: query parameter 'local' does not exist in the json spec",
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.segments:Request / body - A request with inherited properties must have a PropertyBody"
"Request: query parameter 'master_timeout' does not exist in the json spec"
],
"response": []
},
"cat.shards": {
"request": [
"Request: missing json spec query parameter 'time'",
"request definition cat.shards:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
"cat.snapshots": {
"request": [
"Request: missing json spec query parameter 'time'",
"request definition cat.snapshots:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
Expand All @@ -232,29 +184,15 @@
"Request: query parameter 'node_id' does not exist in the json spec",
"Request: query parameter 'master_timeout' does not exist in the json spec",
"Request: missing json spec query parameter 'nodes'",
"Request: missing json spec query parameter 'time'",
"request definition cat.tasks:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.templates": {
"request": [
"request definition cat.templates:Request / body - A request with inherited properties must have a PropertyBody"
],
"response": []
},
"cat.thread_pool": {
"request": [
"request definition cat.thread_pool:Request / body - A request with inherited properties must have a PropertyBody"
"Request: missing json spec query parameter 'time'"
],
"response": []
},
"cat.transforms": {
"request": [
"Request: query parameter 'master_timeout' does not exist in the json spec",
"request definition cat.transforms:Request / query - Property 'h' is already defined in an ancestor class",
"request definition cat.transforms:Request / query - Property 's' is already defined in an ancestor class",
"request definition cat.transforms:Request / body - A request with inherited properties must have a PropertyBody"
"request definition cat.transforms:Request / query - Property 's' is already defined in an ancestor class"
],
"response": []
},
Expand Down

0 comments on commit ae611bc

Please sign in to comment.