Skip to content
New issue

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

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

Already on GitHub? # to your account

Support for named anchors ($ref to a named $id) #220

Open
KurtPreston opened this issue Feb 21, 2019 · 3 comments
Open

Support for named anchors ($ref to a named $id) #220

KurtPreston opened this issue Feb 21, 2019 · 3 comments
Labels
enhancement external This is an issue with a library that we depend on

Comments

@KurtPreston
Copy link

The latest spec allows support for named anchors:
https://json-schema.org/understanding-json-schema/structuring.html#using-id-with-ref

For example, named anchors would allow the following to compile:

{
  "$id": "#myName",
  "properties": {
    "myProp": {
      "$ref": "#myName"
    }
  }
}

Currently, trying to run json-schema-to-typescript against this results in the error:

Error: Refs should have been resolved by the resolver! { '$ref': '#myName' }

Named anchors could be incredibly useful, in cases where one file references another self-referential schema. Is there any way I can get this functionality working with the current version? If not, are there any plans to support this feature in the future?

@KurtPreston KurtPreston changed the title Support for named anchors Support for named anchors ($ref to a named $id) Feb 21, 2019
@KurtPreston
Copy link
Author

Issue seems caused by APIDevTools/json-schema-ref-parser#97

@bcherny bcherny added enhancement external This is an issue with a library that we depend on labels Jun 15, 2019
@David245M
Copy link

What is the status of this issue? Is there support for named anchors like example in question?

@DetachHead
Copy link

duplicate of #132?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement external This is an issue with a library that we depend on
Projects
None yet
Development

No branches or pull requests

4 participants