Open metasection opened 10 years ago
When you define both a server.put and server.post with the same URL, the last define is used as the model for both methods in the Swagger UI.
I would expect the HTTP verb to make these unique.
server.put({url: '/billing/event', swagger: { summary: 'Update', notes: '', nickname: 'putBillingEvent' }, validation: { field1: { isRequired: true, scope: 'body', description: 'Field 1' }, field2: { isRequired: true, scope: 'body', description: 'Field 2' }, field3: { isRequired: true, scope: 'body', description: 'Field 3' }, field4: { isRequired: true, scope: 'body', description: 'Field 4' }, field5: { isRequired: true, scope: 'body', description: 'Field 5' }, field6: { isRequired: true, scope: 'body', description: 'Field 6' }, field7: { isRequired: true, scope: 'body', description: 'Field 7' }, field8: { isRequired: true, scope: 'body', description: 'Field 8' } }}, require('./api/billing_event').putBillingEvent); server.post({url: '/billing/event', swagger: { summary: 'Save', notes: '', nickname: 'postBillingEvent' }, validation: { field1: { isRequired: true, scope: 'body', description: 'Field 1' } }}, require('./api/billing_event').postBillingEvent);
server.post({url: '/billing/event', swagger: { summary: 'Save', notes: '', nickname: 'postBillingEvent' }, validation: { field1: { isRequired: true, scope: 'body', description: 'Field 1' } }}, require('./api/billing_event').postBillingEvent); server.put({url: '/billing/event', swagger: { summary: 'Update', notes: '', nickname: 'putBillingEvent' }, validation: { field1: { isRequired: true, scope: 'body', description: 'Field 1' }, field2: { isRequired: true, scope: 'body', description: 'Field 2' }, field3: { isRequired: true, scope: 'body', description: 'Field 3' }, field4: { isRequired: true, scope: 'body', description: 'Field 4' }, field5: { isRequired: true, scope: 'body', description: 'Field 5' }, field6: { isRequired: true, scope: 'body', description: 'Field 6' }, field7: { isRequired: true, scope: 'body', description: 'Field 7' }, field8: { isRequired: true, scope: 'body', description: 'Field 8' } }}, require('./api/billing_event').putBillingEvent);
Here is the resources json.
"resourcePath": "/swagger/billing", "apis": [ { "path": "/billing/event", "description": "", "operations": [ { "notes": null, "nickname": "postBillingEvent", "produces": [ "application/json" ], "consumes": [ "application/json" ], "responseMessages": [ { "code": 500, "message": "Internal Server Error" } ], "parameters": [ { "name": "Body", "required": true, "dataType": "BillingEvent", "paramType": "body" } ], "summary": "Save", "httpMethod": "POST", "method": "POST" }, { "notes": null, "nickname": "putBillingEvent", "produces": [ "application/json" ], "consumes": [ "application/json" ], "responseMessages": [ { "code": 500, "message": "Internal Server Error" } ], "parameters": [ { "name": "Body", "required": true, "dataType": "BillingEvent", "paramType": "body" } ], "summary": "Update", "httpMethod": "PUT", "method": "PUT" } ] } ], "models": { "BillingEvent": { "properties": { "field1": { "type": "string", "dataType": "string", "name": "field1", "description": "Field 1", "required": true }, "field2": { "type": "string", "dataType": "string", "name": "field2", "description": "Field 2", "required": true }, "field3": { "type": "string", "dataType": "string", "name": "field3", "description": "Field 3", "required": true }, "field4": { "type": "string", "dataType": "string", "name": "field4", "description": "Field 4", "required": true }, "field5": { "type": "string", "dataType": "string", "name": "field5", "description": "Field 5", "required": true }, "field6": { "type": "string", "dataType": "string", "name": "field6", "description": "Field 6", "required": true }, "field7": { "type": "string", "dataType": "string", "name": "field7", "description": "Field 7", "required": true }, "field8": { "type": "string", "dataType": "string", "name": "field8", "description": "Field 8", "required": true } } }
Just tested. Issue persists. Are you tackling these types of issues? If you don't have time, I will take a crack at it when time permits. Please let me know.
Any feedback?
When you define both a server.put and server.post with the same URL, the last define is used as the model for both methods in the Swagger UI.
I would expect the HTTP verb to make these unique.
Example 1
Example 2
Here is the resources json.