How To get an expanded version of a JSON schema that eliminates $ref and allOf references #1125
adarshasp87
started this conversation in
General
Replies: 2 comments
-
I think you want to resolve all the references locally. We don't have any example to do so with JSON schemas but there is an example to merge and resolve all references for OpenAPI specifications. Here is the repo and you can use it as a reference to build your own. |
Beta Was this translation helpful? Give feedback.
0 replies
-
io.swagger.v3.parser.OpenAPIV3Parser is worth mentioning also, it does that without too much fuss, see ParseOptions/.setResolveFully. import io.swagger.v3.parser.OpenAPIV3Parser;
import io.swagger.v3.parser.core.models.ParseOptions;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
public class OpenAPIParserExample {
public static void main(String[] args) {
OpenAPIV3Parser parser = new OpenAPIV3Parser();
ParseOptions options = new ParseOptions();
options.setResolveFully(true);
options.setValidateExternalRefs(true);
SwaggerParseResult result = parser.readContents("{}", null, options);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How To get an expanded version of a JSON schema that eliminates $ref and allOf references, programmatically resolve these constructs into a single schema definition?
Beta Was this translation helpful? Give feedback.
All reactions