Skip to content

"path parameters MUST NOT contain any unescaped “generic syntax” characters" #2804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
karenetheridge opened this issue Nov 26, 2021 · 6 comments
Labels
Needs attention The author has replied and people with triage rights should take action. param serialization Issues related to parameter and/or header serialization

Comments

@karenetheridge
Copy link
Member

karenetheridge commented Nov 26, 2021

at https://spec.openapis.org/oas/v3.1.0#path-templating:

The value for these path parameters MUST NOT contain any unescaped “generic syntax” characters described by [RFC3986]: forward slashes (/), question marks (?), or hashes (#).

Is this referring to the name of the path parameter, or the value itself?

For example, for the path template /pets/{petId}, is it "petId" itself (which is the name clause in the parameter specification) that cannot contain these characters -- that is, a restriction on the openapi document itself? or is it the value of this parameter, at runtime, that cannot contain these characters, for example "cat_01" in the URI /pets/cat_01?

Either way, the language in the specification here could do with a little tightening.

This question has also come up in #2564.

@hkosova
Copy link
Contributor

hkosova commented Nov 26, 2021

Is this referring to the name of the path parameter, or the value itself?

The value itself. See #291 and #892#issuecomment-281170254. This sentence was added to indicate that the value of a path parameter cannot result in additional path segments.

@hkosova
Copy link
Contributor

hkosova commented Nov 26, 2021

I wonder if the names of path parameters are supposed to be restricted to the varname ABNF from RFC 6570, URI Template. OAS itself currently places no restrictions on path parameter names so technically a space " " can be considered be a valid name.

@karenetheridge
Copy link
Member Author

karenetheridge commented Nov 26, 2021

In that case, commit ce732af should be reverted, and possibly replaced with something else - even if just ^[^}]+$ (the name of path parameters can be anything as long as it doesn't contain a closing curly brace -- or are escaped curlies allowed in a path name?).

(I see quite a lot of discussion in old tickets about supporting more of the RFC 6570 syntax in the path specification -- I hope it is still under consideration!)

karenetheridge added a commit to karenetheridge/OpenAPI-Modern that referenced this issue Jan 17, 2022
- there may be escaped slashes, so we must parse out the capture values first
  before we unescape these strings
- they may not be ascii values, so we must utf8-decode the strings as well
- path capture *names* can contain any characters at all, although they
  probably shouldn't (see OAI/OpenAPI-Specification#2804)
@handrews
Copy link
Member

@karenetheridge did PR #3415 getting merged address everything for this issue?

@handrews handrews added Needs author feedback param serialization Issues related to parameter and/or header serialization labels Jan 27, 2024
@github-actions github-actions bot added the No recent activity The issue has not been updated in 7 days. label Feb 3, 2024
Copy link
Contributor

github-actions bot commented Feb 3, 2024

This issue has been labeled with No recent activity because there has been no recent activity. It will be closed if no further activity occurs within 28 days. Please re-open this issue or open a new one after this delay if you need to.

@github-actions github-actions bot added Needs attention The author has replied and people with triage rights should take action. and removed Needs author feedback No recent activity The issue has not been updated in 7 days. labels Feb 23, 2024
@handrews
Copy link
Member

Looking at this more closely, it was definitely fixed by PR #3415. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs attention The author has replied and people with triage rights should take action. param serialization Issues related to parameter and/or header serialization
Projects
None yet
Development

No branches or pull requests

3 participants