Skip to content
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

DefaultUrlTemplate not picking up areas in .Net Core #898

Closed
NorfAlrin opened this issue Aug 23, 2017 · 9 comments
Closed

DefaultUrlTemplate not picking up areas in .Net Core #898

NorfAlrin opened this issue Aug 23, 2017 · 9 comments

Comments

@NorfAlrin
Copy link

Hi,

My config is defined as:

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            "areaRoute",
             "api/{area:exists}/{controller}/{action}/{id?}");
    });
    app.UseSwaggerUi(typeof(Startup).GetTypeInfo().Assembly, new SwaggerUiSettings
        {
            DefaultUrlTemplate = "api/{area:exists}/{controller}/{action}/{id?}",
        });

But the generated swagger.json file outputs the routes without the area eg
api/pet/findByTags

Where I'm expecting
api/staff/pet/findByTags

@RicoSuter
Copy link
Owner

RicoSuter commented Aug 23, 2017

The placeholder {area} is not supported... how is this retrieved?

Ref: https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/areas

@Saibamen
Copy link

I don't have DefaultUrlTemplate...

@Saibamen
Copy link

Screenshot:
image

How to change DefaultUrlTemplate in UseSwaggerUi3?

@RicoSuter
Copy link
Owner

DefaultUrlTemplate is legacy and is not available anymore. Spec can be configured in AddOpenApiDocument(, in UseSwaggerUi3( you specify the ui configs

@RicoSuter
Copy link
Owner

Closed as not relevant anymore (part of asp generator which should not be used for asp net core)

@Saibamen
Copy link

Legacy, obsolete, ok, but was replaced by...? How I can change it now?

How to map API endpoints by action name (to be able to run Swagger without duplicates) and still able to call this same action with [POST] api/login and [POST] api/login/auth` in Postman?

In services.AddOpenApiDocument(settings => I don't have DefaultUrlTemplate too

In recent vesion of NSwagStudio (13.6.1.0) I can still see this option, so this looks like not obsolete...:

image

Swagger/NSwag have really bad documentation and comments like this "it is legacy, closing without helping" is really bad too. People must spend hours to research Internet and trying 50 different solutions to change simple things.

Pushing release tag without any changelog is really stupid IMHO. Where is changelog/braking changes here: https://github.com/RicoSuter/NSwag/releases??? I can't even check and compare commits between versions...

Please see how it is done in normal way on GitHub:
mpchc

And this is how it looks on your "OpenSource" NSwag...:
nswag

@RicoSuter
Copy link
Owner

For ASP.NET Core project you should use the "ASP.NET Core via API Explorer" tab and not the "old" ASP.NET generator.

@Saibamen
Copy link

http://rsuter.com/Projects/NSwagStudio/installer.php download URL not working anymore...

@RicoSuter
Copy link
Owner

Its gone until the build is through, works for me now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants