sylvainlaurent / swagger-validator-maven-plugin

A maven plugin that validates swagger files in yaml and json formats
Apache License 2.0
11 stars 6 forks source link

configurable unique operationId #18

Closed oyeli closed 5 years ago

oyeli commented 5 years ago

@giuliopulina @sylvainlaurent I've updated plugin version from 1.2.2 to 1.2.4 and faced with problem that operationId now have to be unique over complete swagger.json (it was in issue #14). But it isn't correct for us. For example we have endpoints: accounts/{id}/payments/{payment_id}/refunds payments/{payment_id}/refunds on which we use the same operation getRefunds(). I propose to make it configurable. Which way do you think will be the best to solve this problem? For example we can add parameter to pom configuration to define the scope of check (path / all paths ...). I will perform this changes.

giuliopulina commented 5 years ago

Hi @oyeli, Skipping this validation on operationId would be against the 2.0 specification. From https://swagger.io/specification/v2/:

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.

Is it possible for you to change just the operationId(s) to something like 'getRefundsForAccount' and 'getRefunds'?

oyeli commented 5 years ago

Thanks for clarification! Looks like we need to rename our operationIds to be unique.