Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Fixup /swagger root urls#386

Merged
tlmii merged 1 commit intodotnet:masterfrom
tlmii:dev/timulhol/default-template-switch
Sep 10, 2020
Merged

Fixup /swagger root urls#386
tlmii merged 1 commit intodotnet:masterfrom
tlmii:dev/timulhol/default-template-switch

Conversation

@tlmii
Copy link
Member

@tlmii tlmii commented Sep 10, 2020

As of .NET 5 RC1, the dotnet new webapi template now has a default start url of swagger. Because the default Swashbuckle-generated OpenAPI description doesn't contain a Servers element, this will put HttpRepl users that launch from VS/VS Code into a pit of failure by having a base address of https://localhost:{port}/swagger/, even though the API is, by default, based at the root. The user won't be able to navigate their API at all, because you can't navigate "above" the base address.

Since it is unlikely a user would put their API inside the /swagger path, we will special-case this scenario and remove that from the url. We will give the user an escape hatch via the preference if they do put their API under that path.

@tlmii tlmii added this to the 5.0.0 milestone Sep 10, 2020
@tlmii tlmii self-assigned this Sep 10, 2020
Copy link
Member

@bradygaster bradygaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent and cc @coolcsh fyi

Copy link

@bzhu94 bzhu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@tlmii tlmii merged commit 50085b0 into dotnet:master Sep 10, 2020
@tlmii tlmii deleted the dev/timulhol/default-template-switch branch September 10, 2020 21:54
@tlmii tlmii removed this from the 5.0.0 milestone Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants