[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 19/19] qapi: New QMP command query-schema fo
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH RFC 19/19] qapi: New QMP command query-schema for QMP schema introspection |
Date: |
Thu, 23 Apr 2015 15:13:03 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
One question in addition to what Eric already asked:
Am 02.04.2015 um 19:29 hat Markus Armbruster geschrieben:
> +{ 'enum': 'SchemaMetaType',
> + 'data': [ 'builtin', 'enum', 'array', 'object', 'alternate',
> + 'command', 'event' ] }
> +
> +{ 'type': 'SchemaInfoBase',
> + 'data': { 'name': 'str', 'meta-type': 'SchemaMetaType' } }
> +
> +{ 'enum': 'JSONPrimitiveType',
> + 'data': [ 'str', 'int', 'number', 'bool', 'null' ] }
> +
> +{ 'type': 'SchemaInfoBuiltin',
> + 'data': { 'json-type': 'JSONPrimitiveType' } }
> +
> +{ 'type': 'SchemaInfoEnum',
> + 'data': { 'values': ['str'] } }
> +
> +{ 'type': 'SchemaInfoArray',
> + 'data': { 'element-type': 'str' } }
> +
> +{ 'alternate': 'Value',
> + 'data': { 'int': 'int', 'number': 'number', 'str': 'str', 'bool': 'bool' }
> }
> +
> +{ 'type': 'SchemaInfoObjectMember',
> + 'data': { 'name': 'str', 'type': 'str', '*default': 'Value' } }
> +# @default's type must match @type
> +# can only default simple types, not objects or arrays
> +
> +{ 'type': 'SchemaInfoObjectVariant',
> + 'data': { 'case': 'str',
> + 'members': [ 'SchemaInfoObjectMember' ] } }
> +
> +{ 'type': 'SchemaInfoObject',
> + 'data': { 'members': [ 'SchemaInfoObjectMember' ],
> + '*discriminator': 'str',
> + '*variants': [ 'SchemaInfoObjectVariant' ] } }
> +
> +{ 'type': 'SchemaInfoAlternate',
> + 'data': { 'members': [ 'SchemaInfoObjectMember' ] } }
I'm not sure if I understand correctly how this one works. My guess
would be this:
- The elements in members describe the different variants. That is, you
choose of the members, whereas in SchemaInfoObject all of the members
exist. Perhaps they should be using different names then?
- The type (= discriminator) of a variant is indirectly specified by the
'type' of the SchemaInfoObjectMember: This is a QAPI type, but the
JSON type can be resolved by checking 'meta-type' of the QAPI type
(and SchemaInfoBuiltin if necessary)
- The 'name' in SchemaInfoObjectMember could be the key name of the
variant in the alternate definition. However, this name isn't used
anywhere in the QMP protocol, so maybe it is better kept internal.
'name' isn't optional, though.
- The 'default' of SchemaInfoObjectMember must be omitted.
Do I understand the intention reasonably right? If so, maybe it would be
better to use a separate type for alternate variants.
Kevin
Re: [Qemu-devel] [PATCH RFC 19/19] qapi: New QMP command query-schema for QMP schema introspection,
Kevin Wolf <=
[Qemu-devel] [PATCH RFC 16/19] qobject: Clean up around qtype_code, Markus Armbruster, 2015/04/02
[Qemu-devel] [PATCH RFC 13/19] qapi: Factor open_output(), close_output() out of generators, Markus Armbruster, 2015/04/02
[Qemu-devel] [PATCH RFC 10/19] qapi: Factor parse_command_line() out of the generators, Markus Armbruster, 2015/04/02
[Qemu-devel] [PATCH RFC 11/19] qapi: Fix generators to report command line errors decently, Markus Armbruster, 2015/04/02
[Qemu-devel] [PATCH RFC 04/19] qapi: Rename generate_enum_full_value() to c_enum_const(), Markus Armbruster, 2015/04/02