OpenApiInteractionValidator.createFor not reading swagger from custom folder

Issue #346 resolved
Former user created an issue

We are using com.atlassian.oai.validator.restassured.OpenApiValidationFilter for API schema validation.

private static final OpenApiValidationFilter SWAGGER_FILTER_ = new OpenApiValidationFilter( OpenApiInteractionValidator.createFor("swagger.yml") .withBasePathOverride("ese-accounts") .build());

The above code works only when the swagger specs are available in src/main/api folder.

I am trying to read specs from src/main/swagger or src/main/api/swaggers folder.

" java.lang.RuntimeException: Could not find /api/swaggers/swagger.yml on the classpath"

Comments (2)

  1. James Navin

    I would recommend using the createForSpecificationUrl variant, where you can provide any classpath URL (without the classpath: scheme) to reference the spec location (its the same format you would use when using ClassLoader#getResourceAsStream().

    If you get stuck - the loader eventually calls down to io.swagger.v3.parser.util.ClasspathHelper to do the loading.

  2. Log in to comment