Add SelectLocated, golangci-lint, NormalizedPath #9
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.
SelectLocated
works just likeSelect
, but returns a slice ofLocatedNode
s that contain the same nodes as those returned bySelect
paired withNormalizedPath
s that uniquely identify their locations within the JSON query argument. RFC 9535 section 2.7 defines normalized paths, including their string representation, implemented here. The design largely borrows from serde_json_path'squery_located
method.Add
SelectLocated
to theSelector
interface and implement it in each selector, segments, and queries. The implementation is quite similar toSelect
, but takes care to properly constructNormalizedPath
s for each selected node. Update all tests to validate both methods.The new
NormalSelector
interface defines normalized path selectors, of which there are two:Index
andName
.Name
, in particular, attempts to hew to the RFC's stringification grammar as closely as possible.Also: upgrade golangci-lint to v1.62.2 and update its configuration