qemu/tests/qapi-schema/union-invalid-union-subfield.json
Daniel P. Berrangé a17dbc4b79 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>
2023-04-26 07:52:45 +02:00

31 lines
811 B
JSON

# 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' } }