From patchwork Mon Oct 2 15:25:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 820560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@gnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y5Qxr3WYrz9t6m for ; Tue, 3 Oct 2017 02:26:56 +1100 (AEDT) Received: from localhost ([::1]:52824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2cQ-00081y-FL for incoming@patchwork.ozlabs.org; Mon, 02 Oct 2017 11:26:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2bd-0007yK-4S for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2ba-0007w4-Js for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2ba-0007ur-8j for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6182F820E8; Mon, 2 Oct 2017 15:26:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6182F820E8 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 293015279E; Mon, 2 Oct 2017 15:26:01 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B7C1C11562E5; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:38 +0200 Message-Id: <20171002152552.27999-19-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 02 Oct 2017 15:26:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 18/32] docs/devel/qapi-code-gen.txt: Rewrite section on schema syntax X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@gnu.org Sender: "Qemu-devel" Section "QMP/Guest agent schema" is one big paragraph, encumbered with more detail than necessary. It also claims JSON null isn't supported, which is untrue since commit e53188a, v2.4.0. Rewrite it. Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau --- docs/devel/qapi-code-gen.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index f5b7659caf..3186c36460 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -25,24 +25,24 @@ how the schemas, scripts, and resulting code are used. == QMP/Guest agent schema == -A QAPI schema file is designed to be loosely based on JSON -(http://www.ietf.org/rfc/rfc7159.txt) with changes for quoting style -and the use of comments; a QAPI schema file is then parsed by a python -code generation program. A valid QAPI schema consists of a series of -top-level expressions, with no commas between them. Where -dictionaries (JSON objects) are used, they are parsed as python -OrderedDicts so that ordering is preserved (for predictable layout of -generated C structs and parameter lists). Ordering doesn't matter -between top-level expressions or the keys within an expression, but -does matter within dictionary values for 'data' and 'returns' members -of a single expression. QAPI schema input is written using 'single -quotes' instead of JSON's "double quotes" (in contrast, Client JSON -Protocol uses no comments, and while input accepts 'single quotes' as -an extension, output is strict JSON using only "double quotes"). As -in JSON, trailing commas are not permitted in arrays or dictionaries. -Input must be ASCII (although QMP supports full Unicode strings, the -QAPI parser does not). At present, there is no place where a QAPI -schema requires the use of JSON numbers or null. +Schema syntax is based on JSON (RFC 7159), with the following +differences: + +* Comments (see below) + +* No JSON numbers + +* Strings use 'single quotes' instead of "double quotes" + +* The input character set is plain ASCII + + Unicode characters need to be escaped. In contrast, the Client JSON + Protocol uses UTF-8. + +A QAPI schema consists of a sequence of JSON values (top-level +expressions), with no commas between them. The order of top-level +expressions doesn't matter. The order of keys in JSON objects is +generally relevant. === Comments ===