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

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:
Johann150 2022-09-19 10:54:23 +02:00
parent 668181fb44
commit f0b91a62c9
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -200,6 +200,17 @@ export function genOpenapiSpec() {
path.get = { ...info };
// API Key authentication is not permitted for GET requests
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;