profile
viewpoint

Ask questionsIs `:` a valid delimiter for the path parameter?

Dear OpenAPI specification experts,

I have a question regarding "path pattern" and "path parameters". The questionis whether this path pattern /somePath/{param1}:{param2} is valid.

Let's split the whole "path pattern" (/somePath/{param1}:{param2}) into multiple parts with /, so the original "path pattern" contains two parts:

  1. /somePath
  2. /{param1}:{param2}

Usually, every part contains one parameter like this example /cars/{carId}/drivers/{driverId}, where the {carId} and {driverId} are located in different parts. However, /{param1}:{param2} contains two parameters connected with a delimiter :.

This doc shows how style keyword is related to the delimiters, which does not tell that : is a valid delimiter.

As : is not mentioned as one of the supported delimiters, I would assume, my example is an invalid "path pattern". Could you please share your opinion and maybe point out some docs that I might miss.

Thank you very much in advance.

Best regards, Junjie

OAI/OpenAPI-Specification

Answer questions jjtang1985

Hi @MikeRalphson ,

thanks for your quick response.

For me, it seems the path /somePath/{param1}:{param2} is valid, if both parameter param1 and param2 are defined like:

        "parameters": [
          {
            "name": "param1",
            "in": "path",
            ...
          },
          {
            "name": "param2",
            "in": "path",
            ...
          }]

Could you please confirm?

Of course, similar question would be whether the path pattern below are valid:

  • /somePath/{param1}-{param2}
  • /somePath/{param1}={param2}
  • /somePath/{param1}.{param2}
  • other variants with special characters

Best reagards, Junjie

useful!
source:https://uonfu.com/
answerer
Junjie Tang jjtang1985 SAP **Disclaimer:** Opinions expressed are solely my own and do not express the views or opinions of my employer.
Github User Rank List