I can not load my JSON file on ReDoc. I can open JSON file in a browser.
The same JSON working with UseSwaggerUi3WithApiExplorer.
I used UseSwaggerReDocWithApiExplorer in another project and works fine. But now ReDoc was implemented in project with 400 endpoints. It is hard to debug and find witch attribute missing for endpoint.
The problem is with generated JSON file. And redoc.min.js can not handled it. Somehow i must figured out witch endpoints must be changed.
I am using:
.NET CORE 1.0.2.
NSwag.ApiNetCore 11.19.2.0
app.UseSwaggerReDocWithApiExplorer(s =>
{
s.SwaggerRoute = "/redoc/v1/swagger.json";
s.SwaggerUiRoute = "/redoc";
});


can you post the swagger.json to reproduce this?
@RomanGotsiy any idea? You probably need the swagger.json, right?
I can not give JSON file. Company rules.
And in JSON is 20 000 lines.
Maybe you can give me some tips how to debug.
Is it working with SwaggerUi3?
Working if i am using this code:
app.UseSwaggerUi3WithApiExplorer(s =>
{
s.SwaggerRoute = "/swagger_new_ui3/v1/swagger.json";
s.SwaggerUiRoute = "/nswagger";
});
Not loading and can not open JSON file in browser if i am using this code:
app.UseSwaggerUi3(s =>
{
s.SwaggerRoute = "/swagger_ui3/v1/swagger.json";
s.SwaggerUiRoute = "/swaggerui3";
});

But it is okay if i am using UseSwaggerUi3 and loadning JSON file from "/swagger_new_ui3/v1/swagger.json" (JSON file generated by UseSwaggerUi3WithApiExplorer).
In addision. With UseSwaggerReDocWithApiExplorer I can open JSON file generated from another project (another project generated JSON file by UseSwaggerReDocWithApiExplorer).
I can give some parts of JSON, but i can not give it all (begining file, enum, some methods).
From the stacktrace, I can only guess it has something to do with type: file fields.
If you could locate the exact field that breaks and post it here it would be super useful.
@RomanGotsiy I sent an e-mail to you ([email protected]) with a JSON file. I hope this will help you understand more clearly what the problem is.
If there is a problem with the NSwag output, please report here
@Chiliukas I checked out you spec and hunted down the issue to the following snippet:
"files": {
"type": "array",
"items": {
"type": "file"
}
}
If you remove it, ReDoc doesn't crash (you can use it as a temporary workaround). It is clearly a ReDoc 1.x bug and has nothing to do with NSwag ouput. I opened a corresponding issue in ReDoc repo.
@Chiliukas you can close this issue (cc @RSuter).
I checked the same spec with [email protected] and the issue can't be reproduced with it.
While I will fix 1.x bug, @RSuter is there a chance NSwag can support [email protected]?
@RomanGotsiy currently we are using 1.x in the middleware. Can I just switch to the new 2.x version without any problems for users? Or are there some serious breaking changes or some important features which are missing in the 2.x version? Thanks for investigating this problem...
@RSuter yes, it should just work.
Make sure to load it from jsdelivr or unpkg instead of out GitHub pages based CDN as I stopped deploying to it since 2.x. Check out README.
@RomanGotsiy thanks for your answer, can you quickly check the linked PR? Is this fine?
@RomanGotsiy @RSuter Thanks for your answers and investigating this problem. You have helped me a lot. Now everything is working well. It looks like nSwag has very strong support.
Most helpful comment
@RomanGotsiy I sent an e-mail to you ([email protected]) with a JSON file. I hope this will help you understand more clearly what the problem is.