Use a document relative url for specs #444
Merged
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.
That means that what was previously
"urls": ["/example.SomeSpec.yaml"]
will now be
"urls": ["./docs/specs/example.SomeSpec.yaml"]
docs
is from the path the user provided when initializing the route,specs
is added in this PR.This is to be able to write
./specs/example.SomeSpec.yaml
in theurls
array for swagger initialization. Rather than asking for/example.SomeSpec.yaml
, we ask for./example.SomeSpec.yaml
and because this conflicts with other paths such as./swagger-ui.css
I've decided to serve specs under a specific path instead.In the browser, this ends up being:
In the screenshot above, we see requests from the browser after loading
/docs/index.html
from behind a proxy at/admin/docs/index.html
. Before, the request would behttp://localhost/examples.hello.HelloWorldService.json
and it would fail to resolve (missing/admin
), where as nowhttp://localhost/admin/docs/specs/examples.hello.HelloWorldService.json
works.Relates to #439 but its not sufficient to close it.