Skip to content

Commit

Permalink
Adds failing test for issue 270
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego de Estrada committed Jul 26, 2016
1 parent baeb94c commit b719170
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ public void testLoadRelativeFileTree_Json() throws Exception {
//Json.mapper().writerWithDefaultPrettyPrinter().writeValue(new File("resolved.json"), swagger);
}

@Test
public void testLoadExternalNestedDefinitions() throws Exception {
SwaggerParser parser = new SwaggerParser();
final Swagger swagger = parser.read("src/test/resources/nested-references/b.yaml");
Map<String, Model> definitions = swagger.getDefinitions();
assertTrue(definitions.containsKey("x"));
assertTrue(!definitions.containsKey("y"));
assertTrue(definitions.containsKey("z"));
}

@Test
public void testPetstore() throws Exception {
SwaggerParser parser = new SwaggerParser();
Expand Down
14 changes: 14 additions & 0 deletions modules/swagger-parser/src/test/resources/nested-references/a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
swagger: "2.0"
info:
title: test
version: '0.0.0'
paths: {}
definitions:
y:
$ref: "#/definitions/z"
z:
type: object
properties:
name:
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
swagger: "2.0"
info:
title: test
version: '0.0.0'
paths: {}
definitions:
x:
$ref: "./a.yaml#/definitions/y"

0 comments on commit b719170

Please sign in to comment.