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

Additional "refs" mini-spec? #492

Open
zkat opened this issue Jan 20, 2025 · 0 comments
Open

Additional "refs" mini-spec? #492

zkat opened this issue Jan 20, 2025 · 0 comments

Comments

@zkat
Copy link
Member

zkat commented Jan 20, 2025

It might be nice to have a "mini-spec" describing a simple referencing extension to core KDL that will allow for internal references/links between nodes.

For example:

foo $ref=bar-id $ref-kpath="root() > baz"
bar $id=bar-id 123
baz foo=hey {
  quux 😘
}

Would be equivalent to:

foo 123 key=hey {
  quux 😘
}
bar $id=bar-id 123
baz key=hey {
  quux 😘
}

I think this needs to percolate for a bit, though. I really REALLY don't want this to a general expectation of implementations, but I can see some utility in defining it such that DSL authors who want this kind of linking (for example, I'm doing it a lot in the KDL Schema spec) will have "ready-made" syntax and semantics, and possibly even supporting libraries (even if they happen to be bundled with parsers), that will provide this functionality in a well-known, understood way that has already been carefully thought through by a good number of people.

This is pretty important because we start getting into some hairy security implications with this design, some of which we may just not be able to address.

I guess we can literally say "Implementations MUST NOT interpret references in KDL documents except as either a second, explicit path over a parsed document, or as an opt-in option that makes the choice to resolve them clear, explicit, and dependent on the particular format/schema being handled."

I think this way works, because then we wouldn't have to worry about "reserving" anything: if you opt into referencing, you have understood that the format you're developing is going to have certain restricted properties (namely $id, $ref, and $ref-kpath).

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

No branches or pull requests

1 participant