Skip to content

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

@tomsfernandez

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: "_______"

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