Introduce constraints for Server Object url fixed field #4272
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I went ahead with this suggestion, as it is something that is not obvious from reading the OpenAPI spec, but it becomes obvious for the tooling authors during implementations.
Server Object
.url
field is defined asA URL to the target host
.OpenAPI further stipulates:
Looking at RFC 3986, the
Server Object
.url
can be one of the following:Both of these non-terminals allow
query
andfragment
. But effectively, we cannot allow them as OpenAPI further stipulates:Appending to URL or resolved relative reference containing query or fragment will end up corrupting the resulting URL.
There is another aspect of
Server Object
.url
, and that's being Scheme-Based Normalization. When we define server URL ashttps://exmaple.com/
, the tooling tends to remove the last character from the URL, if the character=/
before the path fromPaths Object
is appended to it. This is possible because of equivalence as described by Scheme-Based Normalization.AFAICT we cannot apply Scheme-Based Normalization to URL like
http://example.com/initial-path
.http://example.com/initial-path
is not equivalent anymore tohttp://example.com/initial-path/
.I guess my question is, if we shouldn't restrict
Server Object
.url
not to end with explicit/
?