ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true); // implicit
parseOptions.setResolveFully(true);
String openApiSpec = schemaReference.getUrl(); // Replace with the actual path to your OpenAPI file
SwaggerParseResult result = new OpenAPIV3Parser().readLocation(openApiSpec, null, null);
if (result.getMessages().isEmpty()) {
OpenAPI openAPI = result.getOpenAPI();
// Extract the schema from the OpenAPI specification
ObjectMapper mapper = new ObjectMapper();
JsonNode schemaNode = mapper.convertValue(
openAPI.getComponents().getSchemas().get("NotifyNewAlarm"), JsonNode.class);
// Convert the schemaNode to JSONObject
JSONObject jsonSchema = new JSONObject(new JSONTokener(schemaNode.toString()));
As you can see the $schema is null but the value of $schema should be string.
Hi,
I am trying this code and parsing https://forge.3gpp.org/rep/sa5/MnS/-/blob/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28532_FaultMnS.yaml
As you can see the $schema is null but the value of $schema should be string.
Any ideas what I am lacking?
//mike