use of io.swagger.v3.parser.OpenAPIV3Parser in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue_1292.
@Test
public void testIssue_1292() {
OpenAPIV3Parser openApiParser = new OpenAPIV3Parser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult parseResult = openApiParser.readLocation("issue-1292/petstore.yml", null, options);
OpenAPI openAPI = parseResult.getOpenAPI();
assertNotNull(openAPI.getPaths().get("/pets").getGet().getResponses().get("200").getContent().get("application/json").getSchema().get$ref(), "#/components/schemas/Pets");
assertNotNull(openAPI.getPaths().get("/pets").getGet().getResponses().getDefault().getContent().get("application/json").getSchema().get$ref(), "#/components/schemas/Error");
assertNotNull(openAPI.getComponents().getSchemas().get("Pet"));
assertNotNull(openAPI.getComponents().getSchemas().get("Pets"));
assertNotNull(openAPI.getComponents().getSchemas().get("Error"));
}
use of io.swagger.v3.parser.OpenAPIV3Parser in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue1108.
@Test
public void testIssue1108() {
OpenAPIV3Parser parser = new OpenAPIV3Parser();
OpenAPI openAPI = parser.read("issue-1108.yaml");
assertNotNull(openAPI);
assertNotNull(openAPI.getPaths().get("/pets").getGet().getParameters().get(0).getAllowReserved());
}
use of io.swagger.v3.parser.OpenAPIV3Parser in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue901.
@Test
public void testIssue901() {
ParseOptions options = new ParseOptions();
options.setResolve(true);
OpenAPI openAPI = new OpenAPIV3Parser().readLocation("issue-901/spec.yaml", null, options).getOpenAPI();
assertNotNull(openAPI);
String internalRef = openAPI.getPaths().get("/test").getPut().getResponses().get("200").getContent().get("application/json").getSchema().get$ref();
assertEquals(internalRef, "#/components/schemas/Test.Definition");
assertNotNull(openAPI.getComponents());
}
use of io.swagger.v3.parser.OpenAPIV3Parser in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method checkPathParameterRequiredValue.
@Test
public void checkPathParameterRequiredValue() {
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser().readLocation("src/test/resources/issue-1319.yaml", null, options);
assertEquals(2, swaggerParseResult.getMessages().size());
assertEquals(2, swaggerParseResult.getOpenAPI().getComponents().getSchemas().size());
assertEquals(2, swaggerParseResult.getOpenAPI().getPaths().size());
assertEquals(1, swaggerParseResult.getOpenAPI().getComponents().getParameters().size());
}
use of io.swagger.v3.parser.OpenAPIV3Parser in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue719.
@Test
public void testIssue719() {
final OpenAPI openAPI = new OpenAPIV3Parser().readLocation("extensions-responses.yaml", null, new ParseOptions()).getOpenAPI();
Assert.assertNotNull(openAPI);
Assert.assertNotNull(openAPI.getPaths().getExtensions());
Assert.assertNotNull(openAPI.getPaths().get("/something").getGet().getResponses().getExtensions());
}
Aggregations