OpenApiInteractionValidator.createFor not reading swagger from custom folder
Issue #346
resolved
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)
-
-
- changed status to resolved
Please re-open if you are still having problems.
- Log in to comment
I would recommend using the
createForSpecificationUrl
variant, where you can provide any classpath URL (without theclasspath:
scheme) to reference the spec location (its the same format you would use when usingClassLoader#getResourceAsStream()
.If you get stuck - the loader eventually calls down to
io.swagger.v3.parser.util.ClasspathHelper
to do the loading.