Can't read from file issue in Swagger UI

后端 未结 6 1594
无人共我
无人共我 2021-01-31 13:07

I have incorporated swagger UI in my application.

When I try and see the swagger UI, I get the documentation of the API nicely but after some time it shows some error i

6条回答
  •  死守一世寂寞
    2021-01-31 14:06

    I am guessing "http://MYIP/swagger/docs/v1" is not publicly accessible.

    By default swagger ui uses an online validator: online.swagger.io. If it cannot access your swagger url then you will see that error message.

    Possible solutions:

    1. Disable validation:

      config.EnableSwagger().EnableSwaggerUi(c => c.DisableValidator());

    2. Make your site publicly accessible

    3. Host the validator locally:

    You can get the validator from: https://github.com/swagger-api/validator-badge#running-locally

    You will also need to tell swaggerui the location of the validator

    config.EnableSwagger().EnableSwaggerUi(c => c.SetValidatorUrl());

提交回复
热议问题