serverless-aws-documentation icon indicating copy to clipboard operation
serverless-aws-documentation copied to clipboard

Resource with same path, but different http method

Open Mayhem93 opened this issue 4 years ago • 0 comments

Hello,

I've been using this plugin for quite some time but never had an endpoint with the same path but different method.

Looks like this plugin doesn't like having a different http method because no matter how much I tell it that these two resources are using different method, it just ignores it.

 Serverless: [AWS apigateway 201 0.15s 0 retries] createDocumentationPart({ location: { path: '/api/v1/file', type: 'RESOURCE' },
   properties: '{"description":"Upload firmware file: /api/v1/file"}',
   restApiId: 'uecdxkh0m7' })
 Serverless: [AWS apigateway 201 0.147s 0 retries] createDocumentationPart({ location: { path: '/api/v1/file/check', type: 'RESOURCE' },
   properties: '{"description":"Check firmware object: /api/v1/file"}',
   restApiId: 'uecdxkh0m7' })
 Serverless: [AWS apigateway 201 0.145s 0 retries] createDocumentationPart({ location: { path: '/api/v1/file/list', type: 'RESOURCE' },
   properties: '{"description":"List firmware object files"}',
   restApiId: 'uecdxkh0m7' })
 Serverless: [AWS apigateway 409 0.129s 0 retries] createDocumentationPart({ location: { path: '/api/v1/file', type: 'RESOURCE' },
   properties: '{"description":"Delete firmware file"}',

As seen in this log the first and the last ones use the same path, but they should have different method:

-
  path: "/api/v1/file"
  description: "Upload firmware file: /api/v1/file"
  method: "get"
-
  path: "/api/v1/file/check"
  description: "Check firmware object: /api/v1/file"
-
  path: "/api/v1/file/list"
  description: "List firmware object files"
-
  path: "/api/v1/file"
  description: "Delete firmware file"
  method: "delete"

Obviously cloudformation doesn't like that and it throws an err: Documentation part already exists for the specified location: type 'RESOURCE', path '/api/v1/file'.

So how do I go about this ? 🤔

Mayhem93 avatar Jul 14 '20 10:07 Mayhem93