[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v3 1/8] qapi: Add default-variant f
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v3 1/8] qapi: Add default-variant for flat unions |
Date: |
Thu, 7 Feb 2019 08:46:25 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 2/7/19 8:01 AM, Eric Blake wrote:
>> I think there is: we could provide for an *optional* default value. If
>> the schema specifies it, that's what 'absent' means. If it doesn't, all
>> bets are off, just like they are now.
>
> And we already have the planned syntax, thanks to our recent work on
> adding conditionals - where we now have:
>
> { '*field': 'mytype' }
>
> we can also do long-hand:
>
> { { 'name': '*field', 'type': 'mytype' } }
I'd better use the actual syntax, instead of inventing non-JSON off the
top of my head:
{ '*field': { 'type': 'mytype' } }
>
> which also lends itself well to declaring a default:
>
> { { 'name': '*field', 'type': 'mytype', 'default': 'xyz' } }
{ '*field': { 'type': 'mytype', 'default': 'xyz' } }
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v3 0/8] block: Try to create well-typed json:{} filenames, Max Reitz, 2019/02/06
- [Qemu-block] [PATCH v3 2/8] docs/qapi: Document optional discriminators, Max Reitz, 2019/02/06
- [Qemu-block] [PATCH v3 3/8] tests: Add QAPI optional discriminator tests, Max Reitz, 2019/02/06
- [Qemu-block] [PATCH v3 4/8] qapi: Formalize qcow2 encryption probing, Max Reitz, 2019/02/06
- [Qemu-block] [PATCH v3 5/8] qapi: Formalize qcow encryption probing, Max Reitz, 2019/02/06
- [Qemu-block] [PATCH v3 6/8] block: Try to create well typed json:{} filenames, Max Reitz, 2019/02/06