Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GetAllParametersFromOperations returns incorrect number of parameters #379

Open
kanwardeep007 opened this issue Feb 18, 2025 · 0 comments
Open
Labels
requires investigation This needs to be looked at in more detail

Comments

@kanwardeep007
Copy link

The invocation of GetAllParametersFromOperations (present here ) gives incorrect params (when we drill into the parameters within the nested map) for the same OpenApi Specification

Example of the issue

For the following spec we get 3 params with name random_id

openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
  description: stop complaining
servers:
  - url: https://api.hype.ai
    description: Production server
paths:
  /items/{random_id}:
    get:
      summary: Read Item
      operationId: read_item_items__item_id__get
      parameters:
        - name: random_id
          in: path
          required: true
          schema:
            type: boolean
            title: random id
        - name: random_id
          in: query
          required: true
          schema:
            type: integer
            title: random id
        - name: random_id
          in: query
          required: true
          schema:
            type: boolean
            title: random id
      responses:
        "200":
          description: Successful Response
          content:
            application/json:
              schema: {}

For the same spec but rearranging params, we get 2 params with name random_id (the first param refers to random_id present in query of type integer, the second param refers to random_id present in path of type boolean )

openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
  description: stop complaining
servers:
  - url: https://api.hype.ai
    description: Production server
paths:
  /items/{random_id}:
    get:
      summary: Read Item
      operationId: read_item_items__item_id__get
      parameters:
        - name: random_id
          in: query
          required: true
          schema:
            type: integer
            title: random id
        - name: random_id
          in: query
          required: true
          schema:
            type: boolean
            title: random id
        - name: random_id
          in: path
          required: true
          schema:
            type: boolean
            title: random id
      responses:
        "200":
          description: Successful Response
          content:
            application/json:
              schema: {}

What should happen

For both the specs above we should get 3 parameters when calling GetAllParametersFromOperations and drilling into the parameters within the operation

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
requires investigation This needs to be looked at in more detail
Projects
None yet
Development

No branches or pull requests

2 participants