Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling validation of schema trough validatorUrl(null) not works for 2.8.0 #2201

Closed
Hronom opened this issue Jan 22, 2018 · 8 comments
Closed

Comments

@Hronom
Copy link

Hronom commented Jan 22, 2018

Disabling trough validatorUrl(null) not works for 2.8.0

My pom.xml:

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>2.8.0</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>2.8.0</version>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>1.5.14</version>
            </dependency>
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
            .pathMapping("/")
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.github.hronom"))
            .paths(PathSelectors.any())
            .build()
            .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
            .title("Test API")
            .build();
    }

    @Bean
    UiConfiguration uiConfig() {
        return UiConfigurationBuilder.builder()
            .displayRequestDuration(true)
            .validatorUrl(null)
            .build();
    }
}
@Hronom Hronom changed the title Disabling trough validatorUrl(null) not works for 2.8.0 Disabling validation of schema trough validatorUrl(null) not works for 2.8.0 Jan 22, 2018
@Hronom
Copy link
Author

Hronom commented Jan 22, 2018

Found temporary workaround: empty string as value for validatorUrl, so my work ui config bean looks like:

    @Bean
    UiConfiguration uiConfig() {
        return UiConfigurationBuilder.builder()
            .displayRequestDuration(true)
            .validatorUrl("")
            .build();
    }

For devs of SpringFox I found workaround here swagger-api/swagger-ui#3851 maybe this helps you to solve the problem.

@dilipkrish
Copy link
Member

Thanks for researching the fix @Hronom

@asaunin
Copy link

asaunin commented Feb 9, 2018

I can confirm this bug.
Empty string as a parameter in validatorUrl is a workaround, but javadoc insists that null value has to disable validation. It might mislead.

@Hronom
Copy link
Author

Hronom commented Feb 9, 2018

SpringFox devs, what the status of this?
According to this release you need upgrade to Swagger-UI 3.4.3 or higher, to fix this issue. Quote from release description:

Interface changes: validatorUrl: null configuration works again. Pardon the interruption!

Bugfix: corrected a sanitizer issue that caused validatorUrl: null configurations to break (via #3852)

Please check I'm not familiar how SpringFox communicates with swagger ui.

@dilipkrish
Copy link
Member

@Hronom will incorporate this thanks!

@kumarz
Copy link

kumarz commented Jun 13, 2018

@Hronom, This is exactly , what I was looking for. I got rid of the validator service error in my swagger-ui.

@stale
Copy link

stale bot commented Jun 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 24, 2020
@stale
Copy link

stale bot commented Jul 8, 2020

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

@stale stale bot closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants