Replace template preprocessing with re-mapping. #129
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change attempts to minimally address the awkwardness and
shortcomings of the current URI template preprocessing approach.
In addition to its dubious aesthetics, preprocessing does not
help with using values other than the current instance or an
immediate property (for an object instance) or element (for an
array instance).
Instead, use an object to map the variable names to locations in
the instance with relative JSON pointers. This neatly solves both
the UTF-8/illegal variable name problem and the complex data
structure problem with the same mechanism.
This is close to what is proposed in #52, but that proposal includes
several other related features which are understandably more
controversial. I think this is actually closer to the original
proposal that preceded #52 in the old repo.
The change from
vars
tohrefVars
was inspired by the terminologybeing used in the JSON Home project. While compatibility with JSON
Home is not a goal, I like how this clarifies exactly what the keyword
is intended to do.