Skip to content

OpenApiFilterService.CreateFilteredDocument creates duplicate path parameters for paths with multiple operations when parameters are present at the path level #1840

Closed

Description

Related to microsoft/kiota#5468

In the event an input document has a path with path parameters shared across the operation like this.

  /test/{id}:
    get:
      summary: Summary for test path with id that is longer than 50 characters 
      description: description for test path with id
      operationId: test.WithId
      responses:
        '200':
          description: test
    delete:
      summary: Summary for test path with id that is longer than 50 characters 
      description: description for test path with id
      operationId: test.WithId
      responses:
        '200':
        description: test
    parameters:
    - name: id
      in: path
      required: true
      description: The id of the test
      schema:
        type: integer
        format: int32

The openApiFilterService will treat the parameter as unique for each operation and add a duplicate entry for each operation. like this .

  '/test/{id}':
    get:
      summary: Summary for test path with id that is longer than 50 characters
      description: description for test path with id
      operationId: test_WithId
      responses:
        '200':
          description: test
    delete:
      summary: Summary for test path with id that is longer than 50 characters
      description: description for test path with id
      operationId: test_WithId
      responses: { }
    parameters:
      - name: id
        in: path
        description: The id of the test
        required: true
        style: simple
        schema:
          type: integer
          format: int32
      - name: id
        in: path
        description: The id of the test
        required: true
        style: simple
        schema:
          type: integer
          format: int32

At first glance , this looks to be caused by the OperationSearch that adds the pathItem parameter to the search result of each operation.

Parameters = pathItem.Parameters,

When merging back the results, the FilterServices does not check for uniqueness but adds all the parameters blindly to the filtered document.

pathItem.Parameters.Add(parameter);

Activity

  1. added
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    on Sep 26, 2024
  2. added
    priority:p0Blocking issue/ loss of critical functions. An ICM may be filed to communicate urgency. SLA<=48hrs
    type:bugA broken experience
    and removed
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    on Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

priority:p0Blocking issue/ loss of critical functions. An ICM may be filed to communicate urgency. SLA<=48hrstype:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions