Show multiple versions in scalar viewer in a quirky manner#182
Merged
LucHeart merged 1 commit intoOpenShock:developfrom Apr 20, 2025
Merged
Show multiple versions in scalar viewer in a quirky manner#182LucHeart merged 1 commit intoOpenShock:developfrom
LucHeart merged 1 commit intoOpenShock:developfrom
Conversation
So for whatever reason, the routing really doesn't like the idea of routing to a single field, like /favicon.ico or /scalar To work around this, I propose we add some additional routing so that we can access the API documentation at /scalar/viewer so that users can go there and then choose which version of the API they wish to view
Member
|
I'm not sure I understand? Why wouldn't a top level path work? |
Member
|
so scalar does support multiple versions with s selector also? |
Contributor
Author
|
So if you visit https://api.openshock.app/scalar/ you get this sort of response where it is considering scalar to be a version {"type":"https://docs.api-versioning.org/problems#invalid","title":"Invalid API version","status":400,"detail":"The HTTP resource that matches the request URI 'https://api.openshock.app/scalar/' does not support the API version 'scalar'.","traceId":"00-5de463b17daaa109d66234e9da0d96b5-8e832d76733ff076-00"}I did some digging around, and tinkering, if you add routes like this to Program.cs the one for /test also gives an error, specifically test is an invalid version, the other two routes function normally app.MapGet("/", () => "Hello World!1");
app.MapGet("/test", () => "Hello World!2");
app.MapGet("/test/test", () => "Hello World!3");For scalar, it does support multiple versions with a selector, downside is that you have to specify which documents to show. Which is done by the two calls to AddDocument. They added it a month ago in scalar/scalar#5029 2025-04-18.12-50-54.mp4 |
LucHeart
approved these changes
Apr 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
So for whatever reason, the routing really doesn't like the idea of routing to a single field, like /favicon.ico or /scalar
To work around this, I propose we add some additional routing so that we can access the API documentation at /scalar/viewer so that users can go there and then choose which version of the API they wish to view
Screenshot of what I'm talking about:
