Blog Header Menu

Wednesday, February 27, 2019

Swagger UI : Can't read from file https:///swagger/docs/v1

I recently noticed that web api swagger UI contains Error notification on footer 
SchemaValidation Message
once I click on it and  it redirects to other page and contains below message


{"schemaValidationMessages":[{"level":"error","message":"Can't read from file https:///swagger/docs/v1"}]} 
Swagger UI use online validator to web api swagger document. If API URL is not accessible in public, then
this schema validation message is occurred.

There are two ways to rectify this schema validation error. 
·         Disable Swagger Validation in SwaggerConfig.cs  

GlobalConfiguration.Configuration.EnableSwagger().EnableSwaggerUi(c => { c.DisableValidator(); }); 

·         API URL should be public available. 

Thanks for visiting!!

No comments:

Post a Comment