Official docs:
https://swagger.io/docs/specification/describing-parameters/#common
My valid configuration:
paths:
/posts/{id}:
# This is considered as a request method then trows error
parameters:
- name: id
in: path
description: id
required: true
schema:
type: integer
format: int32
get:
# ...
Error on console:
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at MethodGenerator.includesSuccessResponse (node_modules/swaxios/dist/generators/MethodGenerator.js:62:54)
at new MethodGenerator (node_modules/swaxios/dist/generators/MethodGenerator.js:49:18)
at new ResourceGenerator (node_modules/swaxios/dist/generators/ResourceGenerator.js:40:42)
at node_modules/swaxios/dist/Swaxios.js:45:34
at Generator.next (<anonymous>)
at node_modules/swaxios/dist/Swaxios.js:8:71
at new Promise (<anonymous>)
at __awaiter (node_modules/swaxios/dist/Swaxios.js:4:12)
at exportServices (node_modules/swaxios/dist/Swaxios.js:34:12)
// new MethodGenerator (node_modules/swaxios/dist/generators/MethodGenerator.js:49:18)
const postFix = parameterMatch ? `By${StringUtil.camelCase(parameterMatch.splice(1), true)}` : 'All';
this.parameterMethod = this.operation.operationId || `${this.method}${postFix}`;
if (this.includesSuccessResponse(this.responses)) {
// where
// - postFix: ById
// - parameterMethod: propertiesById
// - this.responses: undefined
// MethodGenerator.includesSuccessResponse (node_modules/swaxios/dist/generators/MethodGenerator.js:62:54
includesSuccessResponse(responses) {
for (const [successCode, response] of Object.entries(responses)) { // <- response is undefined here
So, common parameters should be added to parameters as well, and if common parameters are defined it should be skipped when trying to process methods (operations).
Official docs:
https://swagger.io/docs/specification/describing-parameters/#common
My valid configuration:
Error on console:
So, common parameters should be added to parameters as well, and if common parameters are defined it should be skipped when trying to process methods (operations).