use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue1335.
@Test
public void testIssue1335() {
final ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/issue1335.yaml", null, options);
assertNotNull(result.getOpenAPI().getComponents().getExamples().get("ex1"));
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testDuplicateHttpStatusCodesYaml.
@Test
public void testDuplicateHttpStatusCodesYaml() {
final String location = "src/test/resources/duplicateHttpStatusCodes.yaml";
final ParseOptions options = new ParseOptions();
options.setResolve(true);
final OpenAPIV3Parser parser = new OpenAPIV3Parser();
final SwaggerParseResult result = parser.readLocation(location, null, options);
List<String> messages = result.getMessages();
assertEquals(1, messages.size());
assertEquals(messages.get(0), "Duplicate field 200 in `src/test/resources/duplicateHttpStatusCodes.yaml`");
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method test30.
@Test
public void test30(@Injectable final List<AuthorizationValue> auths) throws Exception {
String pathFile = FileUtils.readFileToString(new File("src/test/resources/oas3.yaml.template"));
pathFile = pathFile.replace("${dynamicPort}", String.valueOf(this.serverPort));
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult result = new OpenAPIV3Parser().readContents(pathFile, auths, options);
Assert.assertNotNull(result);
Assert.assertNotNull(result.getOpenAPI());
assertEquals(result.getOpenAPI().getOpenapi(), "3.0.1");
assertEquals(result.getOpenAPI().getComponents().getSchemas().get("OrderRef").getType(), "object");
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testValidationIssue.
@Test
public void testValidationIssue() {
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolveFully(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/validation/path-parameter-validation.yaml", null, parseOptions);
assertThat(result.getMessages().size(), CoreMatchers.is(0));
}
use of io.swagger.v3.parser.core.models.ParseOptions in project swagger-parser by swagger-api.
the class OpenAPIV3ParserTest method testIssue931.
@Test
public void testIssue931() {
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("Issue_931.json", null, options);
assertNotNull(result.getOpenAPI());
assertTrue(result.getMessages().size() > 0);
assertEquals(result.getMessages().get(0).contains("doesn't adhere to regular expression ^[a-zA-Z0-9\\.\\-_]+$"), true);
}
Aggregations