Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Consider CommonCatQueryParameters to validate query parameters (#3260) #3261

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions compiler/src/steps/validate-rest-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,30 +160,30 @@ export default async function validateRestSpec (model: model.Model, jsonSpec: Ma
if (definition.body.kind !== 'no_body') {
body = Body.yesBody
}

if (definition.attachedBehaviors != null) {
for (const attachedBehavior of definition.attachedBehaviors) {
const type_ = getDefinition({
namespace: '_spec_utils',
name: attachedBehavior
})
if (
type_.kind === 'interface' &&
// allowing CommonQueryParameters too generates many errors
attachedBehavior === 'CommonCatQueryParameters'
) {
for (const prop of type_.properties) {
query.push(prop)
}
}
}
}
} else {
if (definition.properties.length > 0) {
query.push(...definition.properties)
}
}

if (Array.isArray(definition.inherits)) {
const inherits = definition.inherits.map(inherit => getDefinition(inherit.type))
for (const inherit of inherits) {
const properties = getProperties(inherit)
if (properties.path.length > 0) {
path.push(...properties.path)
}

if (properties.query.length > 0) {
query.push(...properties.query)
}

if (properties.body === Body.yesBody) {
body = properties.body
}
}
}

return { path, query, body }
}
}
18 changes: 16 additions & 2 deletions output/openapi/elasticsearch-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions output/openapi/elasticsearch-serverless-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 36 additions & 12 deletions output/schema/schema-serverless.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 36 additions & 12 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading