-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: avoid unnecessary alias to root
Issue #3354 demonstrates that aliases are used when they're not actually needed. When investigating the fix for #2287, I realised where the problem might be, and this is the result. The problem was that all the self-references need to reference the same AST node, but they were not doing so. Fix that by creating the struct node to be embedded when we know that we need a self-reference. We can also use the presence of that node to signal that a self-reference is needed, removing the need for `hasSelfReference`. Fixes #3354 Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ie886b5819c612cbd64abca62d3231aedd530e2bf Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199626 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
Showing
5 changed files
with
42 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,24 +70,14 @@ _schema: { | |
@jsonschema(id="https://www.sourcemeta.com/schemas/vendor/[email protected]") | ||
$else?: #["jsone-value"] | ||
$let?: [string]: null | bool | number | string | [...] | { | ||
[string]: _schema_1 | ||
[string]: _schema | ||
} | ||
$sort?: _schema_5 | [...number] | ||
$sort?: _schema | [...number] | ||
{[!~"^($else|$let|$sort)$"]: #["jsone-value"]} | ||
|
||
#: "jsone-value": _schema_A | [..._schema_8] | ||
#: "jsone-value": _schema | [..._schema] | ||
|
||
#: "jsone-array": [...#["jsone-value"]] | ||
|
||
#: "jsone-object-array": [..._schema_E] | ||
#: "jsone-object-array": [..._schema] | ||
} | ||
|
||
let _schema_1 = _schema | ||
|
||
let _schema_5 = _schema | ||
|
||
let _schema_A = _schema | ||
|
||
let _schema_8 = _schema | ||
|
||
let _schema_E = _schema |
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