question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for semantic path templating

See original GitHub issue

Hi,

I recently ran into the following issue: I have two different types of URIs which support different requests (verbs) and return different values. I tried to write them down as:

paths:
  /{CollectionURI}:
    get:
      summary: List Collection Members
      ...
    post:
      summary: Create a Resource
      ...
    parameters:
      - $ref: "#/parameters/CollectionURI"
  /{MemberURI}:
    get:
      summary: Retrieve a Resource
      ...
    parameters:
      - $ref: "#/parameters/MemberURI"

…which does show up fine in Swagger-UI but is not officially supported. Swagger-Editor doesn’t like it and shows an error.

I asked that question on SO: https://stackoverflow.com/questions/35478531/swagger-equivalent-path-already-exists-despite-different-parameters

Please add support for this kind of path templating in the next version.

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:27 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
fehguycommented, Feb 22, 2016

Unfortunately this is supported in different server frameworks by routing the request based on regexes on the path parameters. I am not saying we should support it but it is somewhat common.

Declaring the regex in the path parameter in the path makes this more tolerable but you still have to deal with the order of the routing, etc

0reactions
JhaDmoorecommented, Nov 10, 2022

Still seems to be a problem in 2022… Servers can route different data types very nicely, hence: GET /resource/{byUUID} and GET/resource/(byString} and GET /resource/{byInt} can all be handled quite easily by most servers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paths and Operations - Swagger
A single path can support multiple operations, for example GET /users to get a list of users and POST /users to add a...
Read more >
Using Templates - OpenAPI Generator
OpenAPI Generator supports user-defined templates. This approach is often the easiest when creating a custom template. Our generators implement ...
Read more >
Configure semantic search - Azure - Microsoft Learn
Add a semantic configuration to an index; Add parameters to a query request. Prerequisites. A search service on Standard tier (S1, S2, S3)...
Read more >
Handlebars
Handlebars provides the power necessary to let you build semantic templates effectively with no frustration. Mustache-compatible. Handlebars is largely ...
Read more >
Path parameter in the path has no corresponding path template
Issue ID: semantic-parameter-nopathtemplate ... Make sure that all path parameters have corresponding path templates, or remove the parameters that do not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found