On Wed, Nov 18, 2020 at 09:56:28AM -0600, Eric Blake wrote: > On 11/18/20 9:45 AM, Eduardo Habkost wrote: > > On Wed, Nov 18, 2020 at 02:53:26PM +0100, Markus Armbruster wrote: > > [...] > >> Another way to skin this cat: > >> > >> {"available": {"kvm": { extra properties... }, > >> "tcg": ..., > >> "xen": ...}, > >> "active": "kvm"} > > > > How would this structure be represented in the QAPI schema? > > > > In other words, how do I say "Dict[str, AccelInfo]" in QAPIese? > > {'type':'AvailAccel', 'data': { > '*kvm': 'KvmExtraProps', > '*tcg': 'TcgExtraProps', > '*xen': 'XenExtraProps', > '*hax': 'HaxExtraProps' } } > {'command':'query-accel', 'returns': { > 'available': 'AvailAccel', 'active': 'strOrEnum' } } > > where adding a new accelerator then adds a new optional member to > AvailAccel as well as possibly a new enum member if 'active' is driving > by an enum instead of 'str'.
Is it possible to represent this if we don't enumerate all possible dictionary keys in advance? (I'm not suggesting we should/shouldn't do that, just wondering if it's possible) -- Eduardo