qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>, qemu-devel@nongnu.org
Cc: "Benoit Canet" <benoit@irqsave.net>,
	armbru@redhat.com, lcapitulino@redhat.com, anthony@codemonkey.ws,
	"Lluís Vilanova" <vilanova@ac.upc.edu>,
	wenchaoqemu@gmail.com
Subject: Re: [Qemu-devel] [PATCH V3 3/3] qapi: Create an include directive for use in the JSON description files.
Date: Mon, 31 Mar 2014 10:45:44 -0600	[thread overview]
Message-ID: <53399BB8.4000600@redhat.com> (raw)
In-Reply-To: <1396023932-17642-4-git-send-email-benoit.canet@irqsave.net>

[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]

On 03/28/2014 10:25 AM, Benoît Canet wrote:
> The new directive in the form { 'include': 'path/to/file.json' } will trigger the
> parsing of path/to/file.json.
> The directive will be replaced by the result of the parsing.
> 
> This will allow for easy modularisation of qapi JSON descriptions files.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>

Just noticed that your S-o-B is in plain ASCII, while your From: uses
Benoît.  Git handles UTF-8 names just fine, so you should feel welcome
to update your git config to use the same spelling in both places (of
course, since my own name doesn't have non-ASCII bytes, I don't quite
know the pain of getting my name munged by various tools...)

> +++ b/docs/qapi-code-gen.txt
> @@ -180,6 +180,20 @@ An example command is:
>     'data': { 'arg1': 'str', '*arg2': 'str' },
>     'returns': 'str' }
>  
> +=== Includes ===
> +
> +A schema file can include other sub schema files with the include
> +directive.
> +
> +An example of include directive is:
> +
> +{ 'include': 'path/to/sub_schema.json' }
> +
> +The include path is relative to the current schema file.
> +The include parsing method is recursive.
> +The expressions resulting from the parsing of the sub schema are injected
> +in place of the include directive like a C #include would do.
> +

Contrast to Lluís' version:

>
> +The QAPI schema definitions can be modularized using the 'include'
directive:
> +
> + { 'include': 'path/to/file.json'}
> +
> +Include paths are relative to the file using the directive.
> +
> +

I like that your version has an actual section on this (since you are
introducing a new top-level key, similar to existing top-level keys for
types, structs, unions, and Wenchao's work on events).  I also like your
explicit mention that include parsing is recursive (making it clear that
a sub-schema can also use include).  But I like Lluís wording better, in
part because it gets to the point in fewer words, and in part because
"relative to the file using the directive" is more precise than
"relative to the current schema file" (especially since the phrase
"injected in place of the include directive" made it fuzzy to me whether
the "current schema file" is the one specified on the command line after
contents have been injected).  Basically, I don't think the last
sentence, in comparing to a C #include, added any value.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-03-31 16:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 16:25 [Qemu-devel] [PATCH V3 0/3] Create an include directive for QAPI JSON files Benoît Canet
2014-03-28 16:25 ` [Qemu-devel] [PATCH V3 1/3] test-qapi: Make test-qapi.py spit useful error messages Benoît Canet
2014-03-28 16:25 ` [Qemu-devel] [PATCH V3 2/3] qapi: Change the qapi scripts to take their input as first argument Benoît Canet
2014-03-28 16:25 ` [Qemu-devel] [PATCH V3 3/3] qapi: Create an include directive for use in the JSON description files Benoît Canet
2014-03-31 16:45   ` Eric Blake [this message]
2014-05-15 12:55 ` [Qemu-devel] [PATCH V3 0/3] Create an include directive for QAPI JSON files Wenchao Xia
2014-05-15 13:02   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53399BB8.4000600@redhat.com \
    --to=eblake@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=benoit@irqsave.net \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vilanova@ac.upc.edu \
    --cc=wenchaoqemu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).