On 08/24/2015 07:07 AM, Eric Blake wrote: > Where things would NOT be allowed due to our prohibition of nested > structs is: > > { 'union': 'Flat', 'base': 'Base', 'discriminator': 'type', > 'data': { 'okay': 'str', 'bad': { 'i': 'int' } } }
I typed that wrong. { 'union': 'Flat', 'base': 'Base', 'discriminator': 'type', 'data': { 'branch1': 'NamedTypeOkay', 'branch2': { 'anon-type-okay': 'str' }, 'branch3': { 'okay': str', 'bad-nesting': { 'i': 'int' } } } } and where anonymous types are still okay is that if we add long-hand for expressing optional types, or otherwise use a dict in place of a type, we can do: { 'union': 'Flat', 'base': 'Base', 'discriminator': 'type', 'data': { 'branch1': 'NamedTypeOkay', 'branch2': { 'anon-type-okay': { 'type': 'str', 'optional': true } } } } , That is, there is a difference between the dictionary expressing an anonymous type, and the dictionary expressing additional attributes belonging to a member of a struct. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature