completecoding / serverless-auto-swagger

80 stars 48 forks source link

operationId overrides generated operationId #100

Closed trbarton closed 2 years ago

trbarton commented 2 years ago

I had a use case where I needed to generate a client side api client using openapi-generator-cli. I wanted custom function names that are controlled by the operationId parameter.

This PR adds the ability to override the default generated operationId as a property on the http event. Example:

{
    http: {
      method: 'get',
      path: '/booking-request/{id}/timeslots',
      operationId: "getTimeslotsByBookingRequestId"
    }
  }
}
bfaulk96 commented 2 years ago

Looks good, could you please add a unit test in tests/ServerlessAutoSwagger.test.ts and then mention this new parameter in the README?

trbarton commented 2 years ago

Updated PR with tests and readme update. This is my first ever open source contribution so welcome to feedback if you think theres something that can be done better

bfaulk96 commented 2 years ago

Thanks for your contribution!