-
Notifications
You must be signed in to change notification settings - Fork 535
Open
Description
We have OpenAPI 3.0.1 spec with examples on relative path, we want to generate a single API file while creating API spec artifact.
Our API Looks like as specified in OpenAPI spec
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#media-type-object
as spec stats that examples could be a map of example/reference values
{
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
},
"examples": {
"cat" : {
"$ref": "./examples/pet/cat.json"
},
"dog": {
"$ref": "./examples/pet/dog.json"
},
"frog": {
"$ref": "./examples/pet/dog.json"
}
}
}
}
}
Source code to generate the single API
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true); // not resolving relative path examples as expected, even with resolveFully
parseOptions.setValidateExternalRefs(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation(inputSpec, null, parseOptions);
result.getMessages().forEach(System.out::println);
Debugging in Intellij shows that ResolverCache.java was able to load the example ref but your code not assigning this as value to your Example.java, hence we see a lot of
attribute ..xxx is unexpected
At the end generated API does not have those example values.
Could you please check if it is a bug or we are missing something in our understanding?
Metadata
Metadata
Assignees
Labels
No labels