fix HTTP GET parameters in OpenAPI docs
All checks were successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
All checks were successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
HTTP GET parameters are not to be specified in the requestBody but in the parameters. This commit fixes that although admittedly it is kind of a bodge and not perfect, but it is a start. Changelog: Fixed
This commit is contained in:
parent
668181fb44
commit
f0b91a62c9
1 changed files with 11 additions and 0 deletions
|
@ -200,6 +200,17 @@ export function genOpenapiSpec() {
|
||||||
path.get = { ...info };
|
path.get = { ...info };
|
||||||
// API Key authentication is not permitted for GET requests
|
// API Key authentication is not permitted for GET requests
|
||||||
path.get.security = path.get.security.filter(elem => !Object.prototype.hasOwnProperty.call(elem, 'ApiKeyAuth'));
|
path.get.security = path.get.security.filter(elem => !Object.prototype.hasOwnProperty.call(elem, 'ApiKeyAuth'));
|
||||||
|
// fix the way parameters are passed
|
||||||
|
delete path.get.requestBody;
|
||||||
|
path.get.parameters = [];
|
||||||
|
for (const name in schema.properties) {
|
||||||
|
path.get.parameters.push({
|
||||||
|
name,
|
||||||
|
in: 'query',
|
||||||
|
schema: schema.properties[name],
|
||||||
|
required: schema.required?.includes(name),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.paths['/' + endpoint.name] = path;
|
spec.paths['/' + endpoint.name] = path;
|
||||||
|
|
Loading…
Reference in a new issue