cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Unique names SDK #61

Closed sangamk closed 4 years ago

sangamk commented 4 years ago

I was wondering why names have to be unique in the generated SDK even though they belong to their own class.

Duplicate operation id 'get'. Assuming id get_1 for operation '/employees.get'. Duplicate operation id 'create'. Assuming id create_1 for operation '/employees.post'. Duplicate operation id 'getById'. Assuming id getById_1 for operation '/employees/{id}.get

Due to this we cannot use generic interfaces as wrappers for the SDK.

luisfpg commented 4 years ago

From the specification:

operationId: Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.

You can, however, use the x-operation-name vendor extension. I've added the supported vendor extensions section to the README file.