forked from FoundKeyGang/FoundKey
fix HTTP GET parameters in OpenAPI docs
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