completecoding / serverless-auto-swagger

80 stars 48 forks source link

Add custom operationId configuration #84

Closed amm1992 closed 1 year ago

amm1992 commented 2 years ago

When auto generating a function with the following example path path: 'products/get-product/{catalogueRef}'

It generates the following in swagger "operationId": "products.get.product/get-products/{categoryId}/",

On our frontend application we use a package to generate the connection to our api and it auto creates the function names from the operation ID. This causes overly complicated function names like "productsGetProductGetProductsCategoryId"

It would be useful if there was an option to manually define the operationId (unless there already is and I can't see anything) as this would allow us to define more meaningful names

bfaulk96 commented 2 years ago

Just a reminder that this tool is used to automatically create a Swagger document from your Serverless file, but not necessarily meant to be a "catch-all" for every case and purpose. The swagger.json generated can theoretically be updated after this plugin generates it originally.

That being said, this is probably doable, and we always welcome contributions 😄

trbarton commented 2 years ago

I've just had the exact same scenario. I've submitted a PR #100 for it

trbarton commented 1 year ago

@bfaulk96 I think this can be closed now. PR #100 is now merged