Skip to content

Process definitions until all models are processed #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@ public void processDefinitions() {

}
}
if (!swagger.getDefinitions().keySet().equals(keySet)) {
processDefinitions();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ public void testLoadExternalNestedDefinitions() throws Exception {
assertEquals(((RefModel) definitions.get("i")).get$ref(), "#/definitions/k");
}

@Test
public void testLoadExternalNestedListRefDefinitions() throws Exception {
SwaggerParser parser = new SwaggerParser();
final Swagger swagger = parser.read("src/test/resources/nested-list-references/api.yaml");
Map<String, Model> definitions = swagger.getDefinitions();
assertTrue(!definitions.isEmpty());
assertTrue(definitions.containsKey("PetList"));
assertTrue(definitions.containsKey("Pet"));
assertTrue(definitions.containsKey("Allergy"));
}

@Test
public void testPetstore() throws Exception {
SwaggerParser parser = new SwaggerParser();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: "Allergy"
properties:
name:
type: string
severity:
type: number
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: "Pet"
properties:
allergies:
type: array
items:
$ref: "./Allergy.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: "PetList"
properties:
pets:
type: array
items:
$ref: "./Pet.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
swagger: "2.0"
info:
title: test data for nested list ext references
version: '0.0.0'
paths:
/:
get:
responses:
"200":
schema:
$ref: "./PetList.yaml"