Mirror of https://github.com/cue-lang/cue cuelang.org
cue go

encoding/jsonschema: fix patternProperties in Extract master

Although the current code goes to some lengths to apply the `patternProperties` constraint only to fields that are not explicitly defined, this does not conform to the spec, which says [1]: > Validation succeeds if, for each instance name that matches any > regular expressions that appear as a property name in this keyword's > value, the child instance for that name successfully validates against > each schema that corresponds to a matching regular expression. That is, there is no interaction between this keyword and the `properties` keyword. I have verified that this is the case manually, and it's borne out by the fact that various external tests start passing. It's a nice bonus that this behavior actually aligns more closely with CUE itself. [1]: https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-01#section-10.3.2.2 Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I52a6fbb5299a1c66f9eb8e2707d5f5fdc267e62e Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1224485 Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>


+10 -20
9 changed files