diff --git a/tools/spectral/ipa/__tests__/createMethodShouldNotHaveQueryParameters.test.js b/tools/spectral/ipa/__tests__/createMethodShouldNotHaveQueryParameters.test.js index 2976a6534d..cb02e27347 100644 --- a/tools/spectral/ipa/__tests__/createMethodShouldNotHaveQueryParameters.test.js +++ b/tools/spectral/ipa/__tests__/createMethodShouldNotHaveQueryParameters.test.js @@ -22,6 +22,14 @@ const componentSchemas = { type: 'string', }, }, + envelope: { + name: 'envelope', + in: 'query', + }, + pretty: { + name: 'pretty', + in: 'query', + }, }, }; @@ -49,6 +57,12 @@ testRule('xgen-IPA-106-create-method-should-not-have-query-parameters', [ { $ref: '#/components/parameters/PathParam', }, + { + $ref: '#/components/parameters/envelope', + }, + { + $ref: '#/components/parameters/pretty', + }, ], }, }, diff --git a/tools/spectral/ipa/rulesets/functions/createMethodShouldNotHaveQueryParameters.js b/tools/spectral/ipa/rulesets/functions/createMethodShouldNotHaveQueryParameters.js index 5b45886df4..b1a910a553 100644 --- a/tools/spectral/ipa/rulesets/functions/createMethodShouldNotHaveQueryParameters.js +++ b/tools/spectral/ipa/rulesets/functions/createMethodShouldNotHaveQueryParameters.js @@ -5,6 +5,8 @@ import { isCustomMethodIdentifier } from './utils/resourceEvaluation.js'; const RULE_NAME = 'xgen-IPA-106-create-method-should-not-have-query-parameters'; const ERROR_MESSAGE = 'Create operations should not have query parameters.'; +const ignoredParameters = ['envelope', 'pretty']; + export default (input, _, { path }) => { const resourcePath = path[1]; @@ -23,7 +25,7 @@ export default (input, _, { path }) => { } for (const parameter of postMethod.parameters) { - if (parameter.in === 'query') { + if (parameter.in === 'query' && !ignoredParameters.includes(parameter.name)) { return collectAndReturnViolation(path, RULE_NAME, ERROR_MESSAGE); } }