Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: ignore empty fragment when comparing schema vers…
…ions It's a very common error for the presence or absence of an empty fragment in schema version URI not to match the presence or absence of the empty fragment in the canonical version URI, particularly as earlier versions included that empty fragment but later versions do not. From a technical point of view, a URI with an empty fragment _should_ be considered identical to a URI with no fragment (as witness Go's `net/url` package which always omits an empty fragment). The specification says [1] of `$schema`: > The value of this keyword MUST be a URI (containing a scheme) and this > URI MUST be normalized. The current schema MUST be valid against the > meta-schema identified by this URI. I think it can reasonably be argued that a URI with a mismatching empty fragment "identifies" the same URL its counterpart. So compare versions while ignoring a trailing empty fragment. [1]: https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-00#rfc.section.8.1.1 Signed-off-by: Roger Peppe <[email protected]> Change-Id: I28c6e767f7be7a2832b42124ffe5f0ec37f83635 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201677 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information