json-schema-org / referencing

Proposals for a possible specification encompassing the varying uses of "$ref"
MIT License
6 stars 1 forks source link

proposal: reserve `$$` or `$-` for non-JRI keywords #6

Open DavidBiesack opened 2 years ago

DavidBiesack commented 2 years ago

The proposal says:

JRI keywords MUST start with a "$" character. Context specifications MAY define their own "$"-prefixed keywords, however this is NOT RECOMMENDED as future specifications that extend JRI as discussed in {{extending}} will use that prefix.

I propose that the proposal extend to allow $$ as a safe prefix that will never be used by JRI.

For example, I may choose to define an object with "$ref":, "$$ref-prod": , "$$ref-qa":, in source to allow specifying alternates URIs , where preprocessing tools on the source can hot-swap $ref and $$ref-prod or $$ref-qa alternatives within a build/deploy pipeline. This could be used where static template or other token substitution does not work well.

Context specifications MAY safely use the "$$" prefix sequence for context keywords. Future JRI keywords MUST NOT start with the "$$" prefix sequence.

(Given that, the proposal could tighten this and say that Context specifications MAY NOT define their own "$"-prefixed keyword unless they use the "$$" prefix.)