APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
952 stars 227 forks source link

[Feature] `dereference.circular` option `reference` #274

Closed wparad closed 2 years ago

wparad commented 2 years ago

next to true, false, and ignore it would be most useful to allow reference as an option, which adds a property circularReference with a link a to the $ref value so that consumers of the document can handle it. Right now, the derefernce has to be used and the circular references have to be redirected outside of the library in order to handle them effectively. The other problem with the current ignore implementation is that is cuts of the circular reference at the top level $ref instead at the moment when the circular reference is detected, leaving the part of the tree that isn't a circular reference as a $ref instead of expanding it :(

wparad commented 2 years ago

closing, if we fix #104 this isn't necessary.

goldingdamien commented 1 year ago

This issue seems to not have been fixed. Please can you check https://github.com/APIDevTools/json-schema-ref-parser/issues/104 Regards.

wparad commented 7 months ago

For anyone that finds this in the future, We got inpatient waiting and ended up for forking this to handle this problem and number of other ones over in: https://github.com/Authress-Engineering/openapi-resolver.js?tab=readme-ov-file#openapi-resolver