Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support remote schemas via $ref #1207

Closed
hmil opened this issue Apr 5, 2022 · 2 comments · Fixed by #1208
Closed

Support remote schemas via $ref #1207

hmil opened this issue Apr 5, 2022 · 2 comments · Fixed by #1208

Comments

@hmil
Copy link
Contributor

hmil commented Apr 5, 2022

Sometimes, one may need to include a sub-schema without re-defining it completely, using the $ref attribute.

An example of such situation is if the object itself contains a json schema. One may want to avoid the overhead of inlining the entire JSON schema spec by using a direct reference to the schema's URL like so:

    "MyObject": {
      "properties": {
        "nested": {
          "$ref": "http://json-schema.org/draft-07/schema#"
        }
      },
      "type": "object"
    }

Suggestion

One convenient way to achieve this would be to support a JSDoc annotation for this purpose:

interface MyObject {
    /**
     * @ref http://json-schema.org/draft-07/schema#
     */
    nested: JSONSchema7;
}
@domoritz
Copy link
Member

domoritz commented Apr 5, 2022

I'd consider a pull request for this.

@github-actions
Copy link

github-actions bot commented Apr 7, 2022

🚀 Issue was released in v1.1.0-next.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants