Swagger-ui not setting our local url after upgrade

Hi,
we have upgraded to latest version of Servicestack and also changed to use Open-Api.
When we start swagger it tries to load the petstore url istead of our.
I also tried to enter localhost:5001/resources but it wont load anything.

How can i change so it loads our api endpoints in swagger?

Please provide more information when reporting issues, e.g. what configuration code are you using to enable Open API, screenshot showing the issue and if there any errors in the console?

Hi, this is the setup i have created. Note that we migrated from old .net version 4.8 to .net 7 and also very old servicestack version.

 ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);
            SetConfig(new HostConfig
            {
                UseSameSiteCookies = true,
                DebugMode = false,
                RedirectPaths = {
                    { "/swagger-ui/", "/swagger-ui/index.html" }
                }
            });
            var swagger = new SwaggerMetadata();
            swagger.Setup();
       //Enable swagger UI for nice test webui and metadata
            Plugins.Add(new OpenApiFeature()
            {
              
            });

That’s because you’re referencing the unmodified static index.html file directly, try the link from your Metadata Page or published in the docs, i.e. /swagger-ui/

Thx it works fine now

1 Like