Routes with hyphen causing swagger-ui issues

I recently started using hyphens in my route urls and it causing me some issues, which I hope we can clarify.

In my ServiceModel, I change an API endpoint route attribute to use a hyphen as follows:

Original

  [Tag("App")]
  [Route("/api/app/usersetting", "GET")]

New

  [Tag("App")]
  [Route("/api/app/user-setting", "GET")]

After making the change, the correct entry appears in swagger-ui and the route works correctly:
https://localhost:72560/api/app/user-setting works correctly.

correct

However:

  1. an additional entry is also listed in swagger-ui, which was not there before using the hyphen:
    why

  2. the additional route https://localhost:72560/usersettings is also working

  3. I do not define the {IndexId} or PATCH routes

As part of the changes, I also upgraded from ServiceStack 5.12.1 to 6.0.3, so in AppHost, I made the following changes as discussed in After upgrading from 5.13.2 to 6.0.3 swagger-ui is not working

  public override void Configure(Container container)
  {
        // ...

        // Disable /api prefix on all services
        ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);

        // Add OpenApiFeature link to /metadata page as /swagger-ui
        var swaggerUrl = "swagger-ui/";
        ConfigurePlugin<MetadataFeature>(
            feature => feature.AddPluginLink(swaggerUrl, "Swagger UI"));

        // ...
  }

Strangely, if I remove the hyphen from the above route, the additional entry and route remain. I have also cloned the code to a clean laptop and have the same results.

Any ideas?

I am using ServiceStack 6.0.3 (Net6/C#10/Windows10).

I’m only seeing the 1 expected route:

How can this be repro’d?

After updating to 6.0.3, I simply added the hyphen to the Route and the problem appeared.

As soon as I have a moment today, I will create a minimal sample.

1 Like

Creating a brand new 6.0.3 project (x new web Hyphen) does exhibit the problem I described with hyphens.

So, it must be something related to upgrading from the project’s previous ServiceStack 5.12.

I will try to reduce my original project to a suitable, minimal, level to demonstrate the problem.