openapi-processor / openapi-processor-core

moved into openapi-processor-base
Apache License 2.0
7 stars 5 forks source link

`operationId` breaks method names with multiple content media types #59

Closed hauner closed 3 years ago

hauner commented 3 years ago

for example, having the following response


paths:
  /foo:
    get:
      # operationId: get_foo
      responses:
        '200':
          description: json or plain text result
          content:
            application/json:
                schema:
                  $ref: '#/components/schemas/Foo'
            text/plain:
                schema:
                  type: string

the processor will/should normally generate two methods

    @Mapping("/foo")
    Foo getFooApplicationJson();

    @Mapping("/foo")
    String getFooTextPlain();

if the endpoint has an operationId: get_foo it overrides the method name generation, especially the media-type postfix:

    @Mapping("/foo")
    Foo getFoo();

    @Mapping("/foo")
    String getFoo();

which does not compile (same erasure getFoo()).

The processor should add the media-type postfix to the operationId if it is set.