-
Notifications
You must be signed in to change notification settings - Fork 3
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
request URI matching: include server object's url field #11
Comments
irrelevant until |
save the results of all the template-variable-replaced server URIs on the document object for future reuse. |
remember, if the server url is relative, it must be resolved against the document's URI. |
|
coming back to this, following a nudge by @Corion...
|
Question, as the spec is ambiguous: do we use the specified enums in server variables as part of the matching process (if the values don't match, we keep iterating through path-items to look for a later match), or do we consider this a match and then a request validation failure? It feels like the intent was the former, but I lean towards the latter being more literally correct vs the spec because there is no provision elsewhere in the document for multiple path-item entries matching save mismatched server variables. example: openapi document looks like: paths:
/foo/bar:
get:
servers:
- url: https://{environment}.example.com/v1
variables:
environment:
default: prod
enum: [staging, prod]
/foo/{fooId}:
get:
servers:
- url: https://test.example.com/v1 Incoming request is The first path-item that matches is /foo/bar (we always consider exact matches ahead of templated ones). However, the server url does not match ("environment" variable cannot be "test", as per the enum). Do we fail to find a matching path-item, or do we fall through to considering /foo/{fooId}? |
see also https://learn.openapis.org/specification/servers.html for a bit more colour |
I have rough code implementing parsing at https://github.com/Corion/URI-Template-Extract/blob/master/lib/URI/Template/Extract.pm - I might release that to CPAN soonish. |
@Corion These aren't URI Templates though -- that's an actual thing with its own RFC. |
Oh ? From https://spec.openapis.org/oas/v3.1.0#server-object , and the phrase But as I see that you already have logic and code to extract the values, I guess the point is moot :) |
URI Templates are https://www.rfc-editor.org/rfc/rfc6570.html -- whereas the It's a bit confusing because real URI Templates are used elsewhere in the specification, in parameter serialization (https://spec.openapis.org/oas/v3.1.0#style-values). |
Ugh - thanks for that clarification. I had assumed that the |
This also depends on #74 (currently in progress). |
keep an eye on OAI/OpenAPI-Specification#3256 also |
Path specifications (patterns under /paths) need to have the server object's url field prepended before matching against the real request URI.
The text was updated successfully, but these errors were encountered: