json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

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

Open KurtPreston opened this issue 6 years ago • 3 comments

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 avatar Feb 21 '19 21:02 KurtPreston

Issue seems caused by https://github.com/APIDevTools/json-schema-ref-parser/issues/97

KurtPreston avatar Feb 26 '19 23:02 KurtPreston

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

David245M avatar Dec 08 '22 14:12 David245M

duplicate of #132?

DetachHead avatar Jan 31 '23 00:01 DetachHead