-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: encode oneOf etc using matchN
This CL updates JSON Schema generation to use the newly added `matchN` primitive for `allOf`, `anyOf` and `oneOf`. This has a much closer correlation with the JSON Schema primitives than the current approach of using CUE's `&` and `|` operators. Specifically: - the schema arguments should not affect the final result other than to validate it, but both `&` and `|` can affect the result. - the result could become non-concrete due to `|` ambiguity in `anyOf`. Although this does fix a bunch of issues, there are some regressions. See issues #3418, #3420, #3422 for details. Comparative test stats (pre-matchN before post-matchN): ``` v2: schema extract (pass / total): 971 / 1637 = 59.3% schema extract (pass / total): 975 / 1637 = 59.6% tests (pass / total): 3081 / 7175 = 42.9% tests (pass / total): 3140 / 7175 = 43.8% tests on extracted schemas (pass / total): 3081 / 3542 = 87.0% tests on extracted schemas (pass / total): 3140 / 3546 = 88.6% v3: schema extract (pass / total): 971 / 1637 = 59.3% schema extract (pass / total): 967 / 1637 = 59.1% tests (pass / total): 3063 / 7175 = 42.7% tests (pass / total): 3074 / 7175 = 42.8% tests on extracted schemas (pass / total): 3063 / 3542 = 86.5% tests on extracted schemas (pass / total): 3074 / 3538 = 86.9% ``` This change also requires that we update the CI generated code and remove the workaround for the previous `oneOf` limitation. For #3380 For #3165 Signed-off-by: Roger Peppe <[email protected]> Change-Id: I2630a6d2b1614b2479802e788c16249d2cf4aa6b Dispatch-Trailer: {"type":"trybot","CL":1200526,"patchset":3,"ref":"refs/changes/26/1200526/3","targetBranch":"master"}
- Loading branch information
Showing
38 changed files
with
472 additions
and
432 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.