Description
-
Springfox swagger version:
2.8.0 -
Step to reproduce:
Create UiConfiguration bean and set validationUrl to null. (As I understand it should turn off validation) -
Current result:
Validation request will be sent to online.swagger and, if server available only in internal network, the error message will be shown. -
Expected result:
Schema validation is disabled, the request is not sent, the error message is not shown. -
Possible reason:
I found that if validationUrl=null in UiConfiguration bean, json from configuration/ui endpoint doesn't contain validationUrl field, that's why the default validation url is used. I tried to set validation url to null in JS in SwaggerUIBundle.vaildationUrl while page is loading and request wasn't be sent.
I guess the reason why json doesn't contain this field is Jackson annotation @JsonInclude(JsonInclude.Include.NON_NULL) on UiConfiguration class. That's why null fields don't add to json on serialization. -
Possible solution:
Add @JsonInclude(JsonInclude.Include.ALWAYS) on validatorUrl. -
Workaround:
set empty space("") in validationUrl in UiConfiguration.
Could you please confirm that it is a bug and I will create PR.