OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
28.91k stars 9.07k forks source link

Need for parameter-overloading #1232

Closed ppKrauss closed 8 months ago

ppKrauss commented 7 years ago

How to do parameter-overloading with OpenAPI?

With the main API Gateway tools, like Apache and NGINX, it is natural using regular expressions.

... Perhaps it is a suggestion to the OpenAPI v3.1...

Example

The declarations say that A and B are distinct var-names with distinct datatypes... But tuday (v2.0) it triggs a "Semantic error: Equivalent paths are not allowed".

  /{A}/xxx:
    get:
      tags:
      - etc.
      summary: etc.
      operationId: op1
      description: etc.
      produces:
      - application/json
      parameters:
      - in: path
        name: A
        description: etc. 
        required: true
        type: integer
        format: int32
        minimum: 1
        maximum: 9999999

  /{B}/xxx:
    get:
      tags:
      - etc.
      summary: etc.
      operationId: op2
      description: etc.
      produces:
      - application/json
      parameters:
      - in: path
        name: B
        description: etc. 
        required: true
        type: string
        pattern: ^[a-z]+$
ePaul commented 7 years ago

This is not supported by OpenAPI (neither 2.0 nor the upcoming 3.0).

ppKrauss commented 7 years ago

Hi @ePaul , thanks feedback.

.... Perhaps v3.1? 4.0?

RobDolinMS commented 7 years ago

TDC: Tagging this for consideration in a future OpenAPI Spec release

handrews commented 8 months ago

This is being addressed in OAS 4 Moonwalk under the operation signatures principle. Please join the discussions in that repository if you are interested!