Can't read from file issue in Swagger UI

后端 未结 6 1577
无人共我
无人共我 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 13:51

    If you are using files from swagger-ui github repo, then you can disable schema validation from your index.html file by setting validatorUrl to null in it:

    window.onload = function() {
    
      // Build a system
      const ui = SwaggerUIBundle({
        url: "/docs/open_api.json",
        dom_id: '#swagger-ui',
    
        validatorUrl : null,   # <----- Add this line
    
        deepLinking: true,
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        plugins: [
          SwaggerUIBundle.plugins.DownloadUrl
        ],
        layout: "StandaloneLayout"
      })
    

提交回复
热议问题