Skip to content

Commit 2eeb301

Browse files
authored
Merge branch 'master' into issue-1261
2 parents f945249 + 2a30061 commit 2eeb301

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public class V2ConverterTest {
9696
private static final String ISSUE_1164_YAML = "issue-1164.yaml";
9797
private static final String ISSUE_1261_YAML = "issue-1261.yaml";
9898

99-
10099
private static final String API_BATCH_PATH = "/api/batch/";
101100
private static final String PETS_PATH = "/pets";
102101
private static final String PET_FIND_BY_STATUS_PATH = "/pet/findByStatus";

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,4 +2302,36 @@ public void testDuplicateHttpStatusCodes() {
23022302
assertEquals(messages.get(0), "Duplicate field '200' in `src/test/resources/duplicateHttpStatusCodes.json`");
23032303

23042304
}
2305+
2306+
public void testSampleParser() {
2307+
final String location = "src/test/resources/issue-1211.json";
2308+
2309+
final ParseOptions options = new ParseOptions();
2310+
options.setResolve(true);
2311+
2312+
final OpenAPIV3Parser parser = new OpenAPIV3Parser();
2313+
final SwaggerParseResult result = parser.readLocation(location, null, options);
2314+
System.out.println(result.getMessages());
2315+
OpenAPI openAPI = result.getOpenAPI();
2316+
2317+
assertNotNull(result.getOpenAPI());
2318+
assertTrue(result.getMessages().size() > 0);
2319+
assertEquals(result.getMessages().get(0).contains("attribute components.schemas.Pet. writeOnly and readOnly are both present"), true);
2320+
2321+
}
2322+
2323+
@Test
2324+
public void testDuplicateHttpStatusCodes() {
2325+
final String location = "src/test/resources/duplicateHttpStatusCodes.json";
2326+
2327+
final ParseOptions options = new ParseOptions();
2328+
options.setResolve(true);
2329+
2330+
final OpenAPIV3Parser parser = new OpenAPIV3Parser();
2331+
final SwaggerParseResult result = parser.readLocation(location, null, options);
2332+
assertNull(result.getOpenAPI());
2333+
List<String> messages = result.getMessages();
2334+
assertEquals(1, messages.size());
2335+
assertEquals(messages.get(0), "Duplicate field '200' in `src/test/resources/duplicateHttpStatusCodes.json`");
2336+
}
23052337
}

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,16 @@
286286
</repositories>
287287
<properties>
288288
<swagger-parser-v2-version>1.0.50-SNAPSHOT</swagger-parser-v2-version>
289-
<commons-io-version>2.4</commons-io-version>
290-
<slf4j-version>1.7.28</slf4j-version>
289+
<commons-io-version>2.6</commons-io-version>
290+
<slf4j-version>1.7.30</slf4j-version>
291291
<swagger-core-version>2.1.1</swagger-core-version>
292-
<junit-version>4.8.1</junit-version>
292+
<junit-version>4.13</junit-version>
293293
<testng-version>6.14.2</testng-version>
294294
<jmockit-version>1.35</jmockit-version>
295295
<wiremock-version>2.15.0</wiremock-version>
296296
<surefire-version>2.21.0</surefire-version>
297297
<commons-lang-version>3.2.1</commons-lang-version>
298-
<jackson-version>2.10.1</jackson-version>
298+
<jackson-version>2.10.2</jackson-version>
299299
</properties>
300300

301301
</project>

0 commit comments

Comments
 (0)