kpramesh2212 / openapi-merger-plugin

A plugin to merge openapi v3 files
Apache License 2.0
20 stars 8 forks source link

Same endpoint in different schemas not working #7

Closed klyver closed 1 year ago

klyver commented 3 years ago

Scenario: You have the same endpoint different schemas, but with different http methods. E.g. schema1 has GET /books and schema2 has POST /books. Ideally there should be no problem in merging such two schemas. Right now either GET /books or POST /books will be left out of the result.

kpramesh2212 commented 3 years ago

@klyver

Could you please provide more details

What version of gradle? what version of the plugin?

Sample input yaml files

klyver commented 3 years ago

Sure.

gradle version 6.6.1 openapi-merger-gradle-plugin version 1.0.4.

bookget.yaml:

info:
  title: OpenAPI definition
  version: v0
servers:
  - url: http://localhost:8080
    description: Generated server url
paths:
  /api/book/{name}:
    get:
      tags:
        - book-controller
      operationId: getBook
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Book'
components:
  schemas:
    Book:
      type: object
      properties:
        name:
          type: string
        iban:
          type: string

and bookpost.yaml

info:
  title: OpenAPI definition
  version: v0
servers:
  - url: http://localhost:8080
    description: Generated server url
paths:
  /api/book/{name}:
    post:
      tags:
        - book-controller
      operationId: getBook
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      requestBody:
        description: The state altering event
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Book'
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Book'
components:
  schemas:
    Book:
      type: object
      properties:
        name:
          type: string
        iban:
          type: string
kpramesh2212 commented 3 years ago

@klyver

This is a defect and can be addressed in the next version.

klyver commented 3 years ago

That sounds great!

rabesocke commented 3 years ago

Are there any news regarding this topic?

kpramesh2212 commented 1 year ago

Will test and then do a release as soon as possible

kpramesh2212 commented 1 year ago

Released in 1.0.5