fix(policies): require non-empty applies_to and fix the set-match example and coverage wording - #661
Open
vishkaty wants to merge 1 commit into
Conversation
…mple and coverage wording Three small policies[] corrections: - policy.json: add `minItems: 1` to `applies_to`. An empty array was schema-valid but matched none of the three defined targeting forms (singular, set, omitted), leaving covers-nothing versus response-wide undefined. Response-wide scope is expressed by omitting `applies_to`. - overview.md: the canonical Set-match example filtered on `@.category`, a field the product schema does not define (it defines `categories` and `tags`), so the example selected the empty set against schema-conformant products. Use `@.tags[?@=='electronics']`, a field products actually carry. - overview.md: the coverage definition read "a prefix of the target node's", which is circular (the target matches a set, not a single node). It is the covered node whose path the matched node's path prefixes; reword to "a prefix of that node's Normalized Path".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Three small
policies[]corrections found while reading the merged policies capability:applies_to: []is undefined. An empty array is schema-valid (nominItemsonpolicy.json) but matches none of the three defined targeting forms (singular, set, omitted). Response-wide scope is expressed by omittingapplies_to, so an empty array has no defined meaning.overview.mdfilters on$.products[?@.category=='electronics'], but the product schema definescategories(array of category objects) andtags(array of strings), notcategory, so the canonical example selects the empty set against a schema-conformant product.Fix
policy.json: addminItems: 1toapplies_to(omit the field for response-wide scope).overview.md: change the example filter to$.products[?@.tags[?@=='electronics']], a field products actually carry.overview.md: reword the coverage sentence to "a prefix of that node's Normalized Path".Verification
No example in
docs/orsource/uses"applies_to": [], sominItems: 1breaks nothing (confirmed by grep and a fullvalidate_examples.pyrun: 282 passing, unchanged).ucp-schema lint source/passes. The new JSONPath is valid RFC 9535.