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

Swagger UI failed to read JSConfig beacause of different cases #266

Closed
sm-g opened this issue Jan 13, 2017 · 3 comments
Closed

Swagger UI failed to read JSConfig beacause of different cases #266

sm-g opened this issue Jan 13, 2017 · 3 comments
Milestone

Comments

@sm-g
Copy link

sm-g commented Jan 13, 2017

I have "Swashbuckle.AspNetCore": "1.0.0-rc1". /swagger/v1/swagger.json is generated fine. But /swagger/index.html failed, because js in case sensitive and html contains:

window.JSConfig = JSON.parse('{"swaggerEndpoints":[{"url":"/swagger/v1/swagger.json","description":"API v1"}],"

but later there is

  window.swaggerUi = new SwaggerUi({
    url: JSConfig.SwaggerEndpoints[0].Url,

and more of them, trying to get properties in pascalcase.

I also noticed when there is just app.UseSwaggerUi) instead of app.UseSwaggerUi(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));, "swaggerEndpoints":[] is empty array (but /swagger/v1/swagger.json is still generated of course). Docs says it will be default value when there is

services.AddSwaggerGen(o =>
{
            o.SwaggerDoc("v1", new Info { Title = "API", Version = "v1" });
}
@sandorfr
Copy link
Contributor

Hi,

I think this is a duplicated issue which has been addressed by this PR.

I think your code or one of your dependencies is settings some global JsonConvert Serialization settings. Which is as bad as relying on those global settings in terms of practices.

I hope the patched code will be released soon, but meanwhile you should remove JsonConvert.DefaultSettings and pass appropriate serialization settings instead when using Serialize or Deserialize.

@sm-g
Copy link
Author

sm-g commented Jan 14, 2017

Very likely. Do you know when this pr will be on nuget?

@sandorfr
Copy link
Contributor

As I'm just an occasional contributor, I have no idea.

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

No branches or pull requests

3 participants