use of io.swagger.v3.core.util.Yaml in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue243.
@Test
public void testIssue243() {
String yaml = "openapi: 3.0.0\n" + "servers: []\n" + "info:\n" + " version: 0.0.0\n" + " title: Simple API\n" + "paths:\n" + " /:\n" + " get:\n" + " responses:\n" + " '200':\n" + " description: OK\n" + " content:\n" + " '*/*':\n" + " schema:\n" + " $ref: '#/components/schemas/Simple'\n" + "components:\n" + " schemas:\n" + " Simple:\n" + " type: string";
SwaggerParseResult result = new OpenAPIV3Parser().readContents(yaml, null, null);
assertNotNull(result.getOpenAPI());
}
use of io.swagger.v3.core.util.Yaml in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testResolveFullyMap.
@Test
public void testResolveFullyMap() {
ParseOptions options = new ParseOptions();
options.setResolveFully(false);
OpenAPI openAPI = new OpenAPIV3Parser().readLocation("resolve-fully-map.yaml", null, options).getOpenAPI();
String yaml = Yaml.pretty(openAPI);
assertTrue(yaml.contains("$ref"));
options = new ParseOptions();
options.setResolveFully(true);
openAPI = new OpenAPIV3Parser().readLocation("resolve-fully-map.yaml", null, options).getOpenAPI();
yaml = Yaml.pretty(openAPI);
assertFalse(yaml.contains("$ref"));
}
use of io.swagger.v3.core.util.Yaml in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue1309.
@Test
public void testIssue1309() {
OpenAPIV3Parser openApiParser = new OpenAPIV3Parser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult parseResult = openApiParser.readLocation("issue-1309.yaml", null, options);
OpenAPI openAPI = parseResult.getOpenAPI();
assertNotNull(openAPI);
assertEquals(parseResult.getMessages().get(0), "attribute components.schemas.customer-not-found.examples is unexpected");
}
use of io.swagger.v3.core.util.Yaml in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue1398.
@Test
public void testIssue1398() {
ParseOptions options = new ParseOptions();
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("issue1398.yaml", null, options);
assertEquals(result.getMessages().get(0), "attribute paths.'/pet/{petId}'(get).parameters.[petId].schemas.multipleOf value must be > 0");
}
use of io.swagger.v3.core.util.Yaml in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testRegressionIssue1236.
@Test
public void testRegressionIssue1236() {
final ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/testRegressionIssue1236.yaml", null, options);
assertTrue(result.getMessages().size() == 0);
}
Aggregations