Skip to content

Resolving Recursive References #175

@dillonredding

Description

@dillonredding

This might already be a known issue, but I haven't found anything exact. There seems to be an issue resolving external references that are recursive. Here's an example (a bit contrived, but narrowed down to the essentials):

foo.yaml:

Foo:
  type: object
  properties:
    bar:
      type: object
      properties:
        foo:
          $ref: '#/Bar'

bar.yaml:

Bar:
  type: object
  properties:
    foo:
      $ref: '#/Bar'

But when resolving through the CLI with json-refs resolve foo.yaml, I get a non-existent reference:

Foo:
  type: object
  properties:
    bar:
      type: object
      properties:
        foo:
          $ref: '#/Bar'

This might be expected behavior (I'm not well versed in the JSON Reference specification); however, one workaround that comes to mind would be to update the reference to where it's actually resolved:

Foo:
  type: object
  properties:
    bar:
      type: object
      properties:
        foo:
          $ref: '#/Foo/properties/bar'

Version of json-refs: 3.0.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions