Skip to content
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

External recursive refs aren't being resolved #278

Closed
diegode opened this issue Aug 2, 2016 · 2 comments · Fixed by #333
Closed

External recursive refs aren't being resolved #278

diegode opened this issue Aug 2, 2016 · 2 comments · Fixed by #333
Milestone

Comments

@diegode
Copy link

diegode commented Aug 2, 2016

This test is failing in master (the last assertion):

@Test
public void testLoadRecursiveExternalDef() throws Exception {
    SwaggerParser parser = new SwaggerParser();
    final Swagger swagger = parser.read("src/test/resources/file-reference-to-recursive-defs/b.yaml");
    Map<String, Model> definitions = swagger.getDefinitions();
    assertEquals(((RefProperty) ((ArrayProperty) definitions.get("v").getProperties().get("children")).getItems()).get$ref(), "#/definitions/v");
    assertTrue(!definitions.containsKey("y"));
    assertEquals(((RefProperty) ((ArrayProperty) definitions.get("x").getProperties().get("children")).getItems()).get$ref(), "#/definitions/x");
}

where a.yaml is:


---
swagger: "2.0"
info:
  title: test
  version: '0.0.0'
paths: {}
definitions:
  y:
    type: object
    properties:
      name:
        type: string
      children:
        type: array
        items:
          $ref: "#/definitions/y"

and b.yaml is:


---
swagger: "2.0"
info:
  title: test
  version: '0.0.0'
paths: {}
definitions:
  x:
    $ref: "./a.yaml#/definitions/y"
  v:
    type: object
    properties:
      name:
        type: string
      children:
        type: array
        items:
          $ref: "#/definitions/v"
@fehguy
Copy link
Contributor

fehguy commented Oct 27, 2016

This has been fixed

@fehguy fehguy closed this as completed Oct 27, 2016
@diegode
Copy link
Author

diegode commented Oct 27, 2016

@fehguy fehguy reopened this Oct 27, 2016
fehguy added a commit that referenced this issue Oct 28, 2016
added check to avoid removing referenced models #278
@fehguy fehguy modified the milestone: v1.0.23 Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants