asyncapi / saunter

Saunter is a code-first AsyncAPI documentation generator for dotnet.
https://www.asyncapi.com/
MIT License
195 stars 55 forks source link

js is not served with .net 6 and named documents #157

Closed JanEggers closed 1 year ago

JanEggers commented 1 year ago

image

devlux commented 1 year ago

hi @JanEggers, can you please show how you configured your api (i.e. Program.cs)? did you call services.ConfigureNamedAsyncApi(...) ? another thing I've noticed is that the documentName part of the path is case-sensitive. and if you build the package by yourself please make sure to call npm install inside Saunter.Ui to fetch the UI dependencies in advance.

JanEggers commented 1 year ago

I use ConfigureNamedAsyncApi and it was working as long as I used net4 (netstandard) we updated to net6 and saunter from 0.9 to 0.11.

the html is served fine so there is no issue with casing or anything else. please have a look at #158. I already submitted a pr with a test that fixes the issue

devlux commented 1 year ago

I wanted to make sure I understood the issue correctly as the examples project within the solution was running fine ~but now with a dedicated solution I was able to reproduce the issue too~... :-)

UPDATE: also with a dedicated solution I was able to render the UI with named documents correctly (with .NET 6 and Saunter v0.11). so it would still make sense you describe your setup.

JanEggers commented 1 year ago

Hi I tried to repro the issue and found it in our code after all. We previously used

  app.UseMiddleware<AsyncApiMiddleware>();
  app.UseMiddleware<AsyncApiUiMiddleware>();

instead of

app.UseEndpoints(endpoints =>
{
    endpoints.MapAsyncApiDocuments();
    endpoints.MapAsyncApiUi();
});

that broke the js and css delivery