Does latest version support v2?
Where can we specify swagger version to use this library?
While parsing the json file, OpenApiValidationFilter is throwing error model.OriginalRef is unexpected. After debugging, i found that this error is thrown from OpenAPIV3Parser. If i am validating for swagger v 2.0 then also it will be using v3 parser?
Which version of these libraries shall i use for swagger v 2.0?
Comments (5)
-
-
Not sure if my issue is the same or not but i got originalRef is unexpected as well. when i try to validate against an autogenerated swagger JSON. by passing the generated JSON URL to OpenApiValidationClientHttpRequestInterceptor(OpenApiInteractionValidator.createFor(String.format("http://localhost:%d/v2/api-docs", port)).build());
Error:
Unable to load API spec from provided URL or payload:
- attribute paths.'/campaign'(put).[campaignDto].originalRef is unexpected
- attribute paths.'/campaign'(post).[campaignDto].originalRef is unexpected
- attribute paths.'/coinTransaction'(post).[rbsTransactionDto].originalRef is unexpected
- attribute paths.'/earnCampaign'(put).[earnCampaignDto].originalRef is unexpected
- attribute paths.'/earnCampaign'(post).[earnCampaignDto].originalRef is unexpected -
- changed status to resolved
Closing due to inactivity. Please feel free to re-open if needed.
-
It looks like your swagger specs may have an additional property
originalRef
, which is not allowed by the Swagger v2 spec. The parser is quite strict about adhering to the schema.Is your generated spec from SpringFox by any chance? It looks like there is an open issue with SpringFox serialization incorrectly adding that field to the generated swagger - see https://github.com/springfox/springfox/issues/2917 for discussion and an example on how to prevent it.
-
Hello , I am getting this issue while parsing path for openAPI
unable to load api spec from provided url or payload
public OpenApiValidationConfig(@Value("${open.api.spec.url}") final String specificationUrl) throws IOException {
final OpenApiInteractionValidator validator = OpenApiInteractionValidator
.createForSpecificationUrl(specificationUrl)
.withBasePathOverride("/v1")
.build();
this.validationInterceptor = new OpenApiValidationInterceptor(validator);
} - Log in to comment
The parser supports v3 and v2. Under the hood it translates the v2 spec to v3 and then uses the
OpenAPIV3Parser
.Are you able to share the spec that causes the error? It might also be useful to see how you're initialising the validator (e.g. passing a string literal or a path to the spec file)