Are specs with circular references supported?

Issue #3 closed
Halil Can Salis created an issue

Hey there, thank you for your work on this library!

I am getting ReferenceErrors when I try to compare swagger files with circular references.

{ VError: ReferenceError: Circular $ref pointer found at /XXX/openapidiff-atlassian/#/definitions/File/properties/absoluteFile
    at Object.<anonymous> (/XXX/openapidiff-atlassian/node_modules/openapi-diff/dist/openapi-diff/spec-differ/diff-finder/json-schema-diff.js:26:15)
    at Generator.throw (<anonymous>)
    at rejected (/XXX/openapidiff-atlassian/node_modules/openapi-diff/dist/openapi-diff/spec-differ/diff-finder/json-schema-diff.js:5:65)
  jse_shortmsg:
   'ReferenceError: Circular $ref pointer found at /XXX/openapidiff-atlassian/#/definitions/File/properties/absoluteFile',
  jse_info: {},
  message:
   'ReferenceError: Circular $ref pointer found at /XXX/openapidiff-atlassian/#/definitions/File/properties/absoluteFile',
  code: 'OPENAPI_DIFF_DIFF_ERROR' }

Looks like circular references are ignored during parsing step but diff step throws this error when it encounters them.

So my question is: does this tool support specs with circular references or is this intentional?

Cheers

Comments (5)

  1. Ben Sayers

    @Halil Can Salis the reason you are getting reference errors is that we do not support circular references at the moment. This is because one of the dependencies of this tool called json-schema-diff does not yet support circular references. My team is working on json-schema-diff however our current focus is on adding support for keywords such as not, anyOf and oneOf so I’m not sure when we will get around to adding support for circular references.

    Our docs didn’t mention that we do not support circular references so I’ve updated them to make this clear.

    Thanks for letting us know about this and happy to hear about any other feedback/suggestions/feature requests you might have!

  2. Log in to comment