use of io.swagger.v3.parser.core.models.AuthorizationValue in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testRefAndInlineAllOf.
@Test
public void testRefAndInlineAllOf(@Injectable final List<AuthorizationValue> auths) throws Exception {
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setResolveFully(true);
OpenAPI openAPI = new OpenAPIV3Parser().read("src/test/resources/allOfAndRef.yaml", auths, options);
Assert.assertNotNull(openAPI);
Assert.assertTrue(openAPI.getComponents().getSchemas().size() == 2);
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("UserEx"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("User"));
Assert.assertTrue(openAPI.getPaths().get("/refToAllOf").getGet().getResponses().get("200").getContent().get("application/json").getSchema().getProperties().size() == 2);
}
use of io.swagger.v3.parser.core.models.AuthorizationValue in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testRemoteParameterIssue1094.
@Test
public void testRemoteParameterIssue1094(@Injectable final List<AuthorizationValue> auths) throws Exception {
OpenAPI result = new OpenAPIV3Parser().read("issue-1094/swagger.yaml");
Assert.assertNotNull(result);
Assert.assertNotNull(result.getComponents().getSchemas().get("PlmnId"));
}
use of io.swagger.v3.parser.core.models.AuthorizationValue in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testRemoteParameterIssue1103.
@Test
public void testRemoteParameterIssue1103(@Injectable final List<AuthorizationValue> auths) throws Exception {
OpenAPI result = new OpenAPIV3Parser().read("issue-1103/remote-parameter-swagger.yaml");
Assert.assertNotNull(result);
Assert.assertEquals(result.getPaths().get("/Translation/{lang}").getPut().getParameters().get(0).getName(), "lang");
}
use of io.swagger.v3.parser.core.models.AuthorizationValue in project swagger-parser by swagger-api.
the class RelativeReferenceTest method testIssue213.
@Test
public void testIssue213() throws Exception {
new Expectations() {
{
RemoteUrl.urlToString("http://foo.bar.com/swagger.json", Arrays.asList(new AuthorizationValue[] {}));
times = 1;
result = spec;
RemoteUrl.urlToString("http://foo.bar.com/path/samplePath.yaml", Arrays.asList(new AuthorizationValue[] {}));
times = 1;
result = samplePath;
}
};
OpenAPI swagger = new OpenAPIV3Parser().read("http://foo.bar.com/swagger.json");
assertNotNull(swagger);
assertNotNull(swagger.getPaths().get("/samplePath"));
assertNotNull(swagger.getPaths().get("/samplePath").getGet());
assertNotNull(swagger.getPaths().get("/samplePath").getGet().getRequestBody());
RequestBody body = swagger.getPaths().get("/samplePath").getGet().getRequestBody();
assertNotNull(body.getContent().get("application/json").getSchema());
}
use of io.swagger.v3.parser.core.models.AuthorizationValue in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testComposedRefResolvingIssue628.
@Test
public void testComposedRefResolvingIssue628(@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);
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("Cat"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("Dog"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("Pet"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("Lion"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("Bear"));
}
Aggregations