use of io.swagger.v3.parser.core.models.ParseOptions 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.core.models.ParseOptions 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());
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue1071True.
@Test
public void testIssue1071True() {
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult parseResult = new OpenAPIV3Parser().readLocation("issue-1071-true.yaml", null, options);
OpenAPI apispec = parseResult.getOpenAPI();
assertNotNull(apispec);
Schema test = apispec.getPaths().get("/mapschema").getGet().getResponses().get("200").getContent().get("application/json").getSchema();
assertTrue(test instanceof MapSchema);
assertTrue(test.getAdditionalProperties() instanceof Boolean);
assertTrue((Boolean) test.getAdditionalProperties());
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testLinkIssue.
@Test
public void testLinkIssue() {
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolveFully(true);
OpenAPI openAPI = new OpenAPIV3Parser().read("src/test/resources/linkIssue.yaml", null, parseOptions);
Map<String, Link> links = openAPI.getPaths().get("/2.0/repositories/{username}").getGet().getResponses().get("200").getLinks();
Object requestBody = links.get("userRepository").getRequestBody();
assertEquals(requestBody, "$response.body#/slug");
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testComposedSchemaAdjacent.
@Test
public void testComposedSchemaAdjacent(@Injectable final List<AuthorizationValue> auths) throws Exception {
ParseOptions options = new ParseOptions();
options.setResolve(true);
OpenAPI openAPI = new OpenAPIV3Parser().read("src/test/resources/composedSchemaRef.yaml", auths, options);
Assert.assertNotNull(openAPI);
Assert.assertTrue(openAPI.getComponents().getSchemas().size() == 5);
Schema schema = openAPI.getPaths().get("/path").getGet().getResponses().get("200").getContent().get("application/json").getSchema();
Assert.assertTrue(schema instanceof ComposedSchema);
ComposedSchema composedSchema = (ComposedSchema) schema;
Assert.assertTrue(composedSchema.getOneOf().size() == 2);
Assert.assertTrue(composedSchema.getAllOf().size() == 1);
}
Aggregations