-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qapi: allow unions to contain further unions
This extends the QAPI schema validation to permit unions inside unions, provided the checks for clashing fields pass. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230420102619.348173-4-berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
- Loading branch information
Showing
12 changed files
with
234 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
union-invalid-union-subfield.json: In union 'TestUnion': | ||
union-invalid-union-subfield.json:25: member 'teeth' of type 'TestTypeFish' collides with base member 'teeth' |
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,30 @@ | ||
# Clash between common member and union variant's variant member | ||
# Base's member 'teeth' clashes with TestTypeFish's | ||
|
||
{ 'enum': 'TestEnum', | ||
'data': [ 'animals', 'plants' ] } | ||
|
||
{ 'enum': 'TestAnimals', | ||
'data': [ 'fish', 'birds'] } | ||
|
||
{ 'struct': 'TestTypeFish', | ||
'data': { 'scales': 'int', 'teeth': 'int' } } | ||
|
||
{ 'struct': 'TestTypeBirds', | ||
'data': { 'feathers': 'int' } } | ||
|
||
{ 'union': 'TestTypeAnimals', | ||
'base': { 'atype': 'TestAnimals' }, | ||
'discriminator': 'atype', | ||
'data': { 'fish': 'TestTypeFish', | ||
'birds': 'TestTypeBirds' } } | ||
|
||
{ 'struct': 'TestTypePlants', | ||
'data': { 'integer': 'int' } } | ||
|
||
{ 'union': 'TestUnion', | ||
'base': { 'type': 'TestEnum', | ||
'teeth': 'int' }, | ||
'discriminator': 'type', | ||
'data': { 'animals': 'TestTypeAnimals', | ||
'plants': 'TestTypePlants' } } |
Empty file.
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,2 @@ | ||
union-invalid-union-subtype.json: In union 'TestUnion': | ||
union-invalid-union-subtype.json:25: base member 'type' of type 'TestTypeA' collides with base member 'type' |
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,29 @@ | ||
# Clash between common member and union variant's common member | ||
# Base's member 'type' clashes with TestTypeA's | ||
|
||
{ 'enum': 'TestEnum', | ||
'data': [ 'value-a', 'value-b' ] } | ||
|
||
{ 'enum': 'TestEnumA', | ||
'data': [ 'value-a1', 'value-a2' ] } | ||
|
||
{ 'struct': 'TestTypeA1', | ||
'data': { 'integer': 'int' } } | ||
|
||
{ 'struct': 'TestTypeA2', | ||
'data': { 'integer': 'int' } } | ||
|
||
{ 'union': 'TestTypeA', | ||
'base': { 'type': 'TestEnumA' }, | ||
'discriminator': 'type', | ||
'data': { 'value-a1': 'TestTypeA1', | ||
'value-a2': 'TestTypeA2' } } | ||
|
||
{ 'struct': 'TestTypeB', | ||
'data': { 'integer': 'int' } } | ||
|
||
{ 'union': 'TestUnion', | ||
'base': { 'type': 'TestEnum' }, | ||
'discriminator': 'type', | ||
'data': { 'value-a': 'TestTypeA', | ||
'value-b': 'TestTypeB' } } |
Empty file.
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