From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz2oL-0001BA-8u for qemu-devel@nongnu.org; Tue, 16 Jul 2013 06:48:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz2oJ-0002Fc-BY for qemu-devel@nongnu.org; Tue, 16 Jul 2013 06:48:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz2oJ-0002FI-0a for qemu-devel@nongnu.org; Tue, 16 Jul 2013 06:48:47 -0400 Message-ID: <51E52504.5060306@redhat.com> Date: Tue, 16 Jul 2013 12:48:36 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1373971062-28909-1-git-send-email-akong@redhat.com> <1373971062-28909-3-git-send-email-akong@redhat.com> In-Reply-To: <1373971062-28909-3-git-send-email-akong@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: armbru@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com Il 16/07/2013 12:37, Amos Kong ha scritto: > So here I defined a 'DataObject' type in qapi-schema.json, > it's used to describe the dynamical dictionary/list/string. > > { 'type': 'DataObject', > 'data': { '*key': 'str', '*type': 'str', '*data': ['DataObject'] } } This is missing '*optional': 'bool'. Also, how do you distinguish these: { 'command': 'query-tpm-types', 'returns': 'TpmType] } { 'command': 'query-tpm-types', 'returns': ['TpmType'] } Could it have to be like this? 'data': { '*key': 'str', '*type': 'str', '*list': 'bool', '*optional': 'bool', '*data': ['DataObject'] } } Can you document, in the commit message or the code, how you avoid infinite loops (possible with optional or list fields)? Paolo > Not all the keys in data will be used. > # List: type > # Dict: key, type > # nested List: type, data > # nested Dict: key, type, data > > The DataObject is described in docs/qmp-full-introspection.txt in > detail. > > The following content gives an example of query-tpm-types: > > ## Define example in qapi-schema.json: > > { 'enum': 'TpmType', 'data': [ 'passthrough' ] } > { 'command': 'query-tpm-types', 'returns': ['TpmType'] } > > ## Returned description: > > { > "name": "query-tpm-types", > "type": "Command", > "returns": [ > { > "type": "TpmType", > "data": [ > { > "type": "passthrough" > } > ] > } > ] > },