RedHatInsights / insights-api-common-rails

Header, Encryption, RBAC, Serialization, Pagination and other common behavior for Insights microservices built with Rails
Apache License 2.0
3 stars 25 forks source link

Enforce unique operation ids #182

Closed mkanoor closed 4 years ago

mkanoor commented 4 years ago

If there are duplicate operationIds we raise an exception with the generated method name and the offending class.

ArgumentError: operation id cannot be duplicates, listApplicationAuthentications in class ApplicationAuthentication has already been used in class Authentication

This PR allows a class to override the operation Id for list operations only for now by creating a class method called list_operation_id e.g.

def self.list_operation_id
  "listAllApplicationAuthentications"
end

This helps when we have 2 REST calls which use the same generated operationId a way to override ride as well as check for duplicates during the generations

GET /application_authentications => listAllApplicationAuthentications GET /applications/{id}/authentications => listApplicationAuthentications

mkanoor commented 4 years ago

@gmcculloug Please review