5223070c47
Since enum based discriminators provide better type-safety and ensure that future qapi additions do not forget to adjust dependent unions, forbid using string as discriminator from now on. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
18 lines
389 B
JSON
18 lines
389 B
JSON
{ 'enum': 'TestEnum',
|
|
'data': [ 'value1', 'value2' ] }
|
|
|
|
{ 'type': 'TestBase',
|
|
'data': { 'enum1': 'TestEnum', 'kind': 'str' } }
|
|
|
|
{ 'type': 'TestTypeA',
|
|
'data': { 'string': 'str' } }
|
|
|
|
{ 'type': 'TestTypeB',
|
|
'data': { 'integer': 'int' } }
|
|
|
|
{ 'union': 'TestUnion',
|
|
'base': 'TestBase',
|
|
'discriminator': 'kind',
|
|
'data': { 'kind1': 'TestTypeA',
|
|
'kind2': 'TestTypeB' } }
|