Swagger-ui: Validator badge is always enabled and can't be disabled

Created on 21 Mar 2017  路  4Comments  路  Source: swagger-api/swagger-ui

Previously validator badge was hidden if the false value (null, false) was explicitly provided as validatorUrl, or if the spec was being loaded from localhost: https://github.com/swagger-api/swagger-ui/blob/2.x/src/main/javascript/view/MainView.js#L57-L65

New validator badge component always uses the default url if validatorUrl value is not truthy: https://github.com/swagger-api/swagger-ui/blob/33e5775dcff74c306904c6c7d0e2816828ba9878/src/core/components/online-validator-badge.jsx#L10

I think the default validatorUrl should only be used if the value is undefined, that is, when no explicit value is not set. Hiding the validator when spec is served from localhost is also good idea, as validating that going to fail always.

3.x

Most helpful comment

The ability to remove the validator is a missing feature. It will be addressed shortly

All 4 comments

It was quite useful to set a value of null as we host static swagger-ui sites which the validator can't reach. The alternative is to host our own validator internally, which would be a waste of resources in our pipeline.

The ability to remove the validator is a missing feature. It will be addressed shortly

@Deraen @i-ghost in latest master validator badge can be disabled with config validatorUrl other than undefined, when undefined - default validator is displayed

Was this page helpful?
0 / 5 - 0 ratings