@Test public void testIssueRelativeRefs2(){ String location = "exampleSpecs/specs/my-domain/test-api/v1/test-api-swagger_v1.json"; ParseOptions po = new ParseOptions(); po.setResolve(true); SwaggerParseResult result = new OpenAPIParser().readLocation(location, null, po); assertNotNull(result.getOpenAPI()); OpenAPI openAPI = result.getOpenAPI(); Map<String, Schema> schemas = openAPI.getComponents().getSchemas(); Assert.assertTrue(schemas.get("confirmMessageType_v01").getProperties().get("resources") instanceof ArraySchema); ArraySchema arraySchema = (ArraySchema) schemas.get("confirmMessageType_v01").getProperties().get("resources"); Schema prop = (Schema) arraySchema.getItems().getProperties().get("resourceID"); assertEquals(prop.get$ref(),"#/components/schemas/simpleIDType_v01"); }
public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult output = null; for(SwaggerParserExtension extension : OpenAPIV3Parser.getExtensions()) { output = extension.readLocation(url, auth, options); if(output != null && output.getOpenAPI() != null) { return output; } } return output; }
OpenAPIParser { public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult output = null; for(SwaggerParserExtension extension : OpenAPIV3Parser.getExtensions()) { output = extension.readLocation(url, auth, options); if(output != null && output.getOpenAPI() != null) { return output; } } return output; } }
OpenAPIParser { public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult output = null; for(SwaggerParserExtension extension : OpenAPIV3Parser.getExtensions()) { output = extension.readLocation(url, auth, options); if(output != null && output.getOpenAPI() != null) { return output; } } return output; }  }
OpenAPIParser { public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult output = null; for(SwaggerParserExtension extension : OpenAPIV3Parser.getExtensions()) { output = extension.readLocation(url, auth, options); if(output != null && output.getOpenAPI() != null) { return output; } } return output; }  SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options); SwaggerParseResult readContents(String swaggerAsString, List<AuthorizationValue> auth, ParseOptions options); }
OpenAPIParser { public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult output = null; for(SwaggerParserExtension extension : OpenAPIV3Parser.getExtensions()) { output = extension.readLocation(url, auth, options); if(output != null && output.getOpenAPI() != null) { return output; } } return output; }  SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options); SwaggerParseResult readContents(String swaggerAsString, List<AuthorizationValue> auth, ParseOptions options);  }