Skip to content
  • Kevin Wolf's avatar
    qapi: Anonymous unions · 69dd62df
    Kevin Wolf authored
    
    
    The discriminator for anonymous unions is the data type. This allows to
    have a union type that allows both of these:
    
        { 'file': 'my_existing_block_device_id' }
        { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }
    
    Unions like this are specified in the schema with an empty dict as
    discriminator. For this example you could take:
    
        { 'union': 'BlockRef',
          'discriminator': {},
          'data': { 'definition': 'BlockOptions',
                    'reference': 'str' } }
        { 'type': 'ExampleObject',
          'data: { 'file': 'BlockRef' } }
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    69dd62df