building OpenApiInteractionValidator from String payloads
com.atlassian.oai.validator.OpenApiInteractionValidator#createFor
is supposed to be able to take "inline specification to use" ie. the actual specification as eg JSON string. But it never works given that OpenAPIParser sees OpenAPIV3Parser and/or OpenAPIV3Parser as Extensions.
com.atlassian.oai.validator.OpenApiInteractionValidator#loadApi
expects that openAPIParser.readLocation
returns null if it encounters problems.
But instead, for example OpenAPIV3Parser will throw an exception if it is unable it use "location" as either URI or file path.
This is important, I a want to use swagger-request-validator as part of the web application to validate requests to its own APIs.
Caused by:
com.atlassian.oai.validator.OpenApiInteractionValidator$ApiLoadException: Unable to load API spec from provided URL or payload:|?- attribute info is missing
at com.atlassian.oai.validator.OpenApiInteractionValidator.loadApi(OpenApiInteractionValidator.java:155)
at com.atlassian.oai.validator.OpenApiInteractionValidator.<init>(OpenApiInteractionValidator.java:123)
at com.atlassian.oai.validator.OpenApiInteractionValidator.<init>(OpenApiInteractionValidator.java:45)
at com.atlassian.oai.validator.OpenApiInteractionValidator$Builder.build(OpenApiInteractionValidator.java:426)
Comments (4)
-
-
- edited description
-
Thanks @10terabytes. I'll mark the issue as resolved. If you think there is a problem with the SRV please feel free to re-open.
-
- changed status to resolved
- Log in to comment
I am sorry, the issue was elsewhere. I replaced passing URL to openap.json in the same web application:
with code that creates the spec in OpenApiContextLocator.:
The problem (no idea why it happens) is that HTTP GET to "openapi.json" responds with JSON document containing "info" section based on static resource "openapi-configuration.json", but OpenAPI misses this element (This "info" section is not actually needed to validate requests coming to the application, but required to build OpenApiInteractionValidator)
Please disregard or close.