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

$ref should accept $id references #55

Closed
ImBoop opened this issue Apr 13, 2020 · 3 comments · Fixed by #107
Closed

$ref should accept $id references #55

ImBoop opened this issue Apr 13, 2020 · 3 comments · Fixed by #107
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@ImBoop
Copy link

ImBoop commented Apr 13, 2020

As part of JSONSchema Draft 6, $ref can point to a definition defined with an $id (or just id, spec seems vague if its $id or id in v6) -- it would be wonderful if we could get support for that here.

For instance, in definitions we will be able to use {"references": { "$id": "#test", ... }} and in our core properties, refer to it via {"properties": {"$ref": "#test", ...}}

Thanks!

@aeschli aeschli added the feature-request Request for new features or functionality label Nov 12, 2020
@aeschli aeschli added this to the Backlog milestone Nov 12, 2020
@forivall
Copy link

forivall commented Apr 15, 2021

I'm interested in tackling this, either in a PR or in an external vscode extension (probably both, as i'll want to have the flexibility of my own extension for other resolver logic for external references, and then i'll upstream relevant features).

some links:

@aeschli
Copy link
Contributor

aeschli commented Apr 15, 2021

Hi @forivall, thanks for the interest, you are very welcome, a PR would be great!

We currently resolve the $refs in a step called resolveSchemaContent:

public resolveSchemaContent(schemaToResolve: UnresolvedSchema, schemaURL: string, dependencies: SchemaDependencies): Thenable<ResolvedSchema> {

To run and debug this, see here for instructions. You can find some ref related tests her.

I'm happy to help. I've started looking into it but realized it's not a trivial change and we might have to restructure the way we do the resolving.

@jviotti
Copy link

jviotti commented Jun 17, 2024

As a workaround, my JSON Schema CLI tool supports performing bundling without making use of identifiers to at least make schemas work with Visual Studio Code: https://github.com/Intelligence-AI/jsonschema/blob/main/docs/bundle.markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants