This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue: keep sane references for embedded disjunctions in Expr
In Expr, simulate a struct with just the fields so that embedded disjunctions with references to such fields will direct to the unmerged values of these references. This also addes OpenAPI tests, which relies on this functionality. Change-Id: I5d127fee1389a88a45f3705ad1a0c929ee1c2bb0 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9881 Reviewed-by: Paul Jolly <[email protected]>
- Loading branch information
Showing
6 changed files
with
268 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "test", | ||
"version": "v1" | ||
}, | ||
"paths": {}, | ||
"components": { | ||
"schemas": { | ||
"Foo": { | ||
"type": "string" | ||
}, | ||
"LoadBalancerSettings": { | ||
"type": "object", | ||
"properties": { | ||
"consistentHash": { | ||
"type": "object", | ||
"properties": { | ||
"httpHeaderName": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"b": { | ||
"type": "string" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"consistentHash", | ||
"b" | ||
], | ||
"properties": { | ||
"consistentHash": { | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"consistentHash", | ||
"b" | ||
], | ||
"properties": { | ||
"consistentHash": { | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"LoadBalancerSettings.ConsistentHashLB": { | ||
"type": "object", | ||
"properties": { | ||
"httpHeaderName": { | ||
"type": "string" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Foo: string | ||
|
||
#LoadBalancerSettings: { | ||
{} | { | ||
consistentHash: #ConsistentHashLB | ||
b: #Foo | ||
} | ||
#ConsistentHashLB: {} | { | ||
httpHeaderName: string | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Generated by cue.", | ||
"version": "no version" | ||
}, | ||
"paths": {}, | ||
"components": { | ||
"schemas": { | ||
"Foo": { | ||
"type": "string" | ||
}, | ||
"LoadBalancerSettings": { | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"consistentHash", | ||
"b" | ||
], | ||
"properties": { | ||
"consistentHash": { | ||
"$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB" | ||
}, | ||
"b": { | ||
"$ref": "#/components/schemas/Foo" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"consistentHash", | ||
"b" | ||
], | ||
"properties": { | ||
"consistentHash": { | ||
"$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB" | ||
}, | ||
"b": { | ||
"$ref": "#/components/schemas/Foo" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"LoadBalancerSettings.ConsistentHashLB": { | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"not": { | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
], | ||
"properties": { | ||
"httpHeaderName": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"httpHeaderName" | ||
], | ||
"properties": { | ||
"httpHeaderName": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |