Skip to content

Clarification about path template uri that may or not clash with other paths #2953

Closed

Description

@tomsfernandez

Hi!. This is related to: #2753

Context: we have an OAS 3.0 api with two path objects: /v2 and /v2{param}. "Param" is a required parameter so in practice the second endpoint should always result in a different uri than the first one f.e: /v2 vs /v2test ("param" is parameterized with "test").

The question is: do these paths clash with each other or are they valid according to the spec? The only thing I found but that doesn't apply to this case completely is:

When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical

What would happen if instead of only two path objects, there were three:

  • /v2
  • /v2another
  • /v2{param} (clashes with /v2another if param == another)

This is all without taking into account the different styles the template parameter could have.

How should API processors handle all these variations? It seems to me that this might be really error-prone for processors.

Here an API showcasing this:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: mytest
paths: 
  /v2:
    get:
      responses:
        "200":
          description: "___"
  /v2{params}:
    parameters:
      - in: path
        name: params
        required: true
        schema:
          type: string
    post:
      responses:
        "200":
          description: "_______"

Activity

  1. locked and limited conversation to collaborators on Jun 24, 2022
  2. converted this issue into a discussion #2954 on Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions