Il 02/07/2013 22:58, Anthony Liguori ha scritto: > > > We consume the schema in QEMU. No reason for us to consume it in a > > > different format than libvirt. > > > > One reason could be that qapi-schema.json, as written, lacks a schema > > that can be expressed itself using QAPI. > > Yup, but how much does that matter in practice?
It matters little because we do not provide a library of QAPI parsers/visitors, so clients have to invent their own anyway. But if we did, clients would be completely oblivious of the fact that QMP is based on JSON. Sending qapi-schema.json down the wire as a JSON string would break the abstraction that we provide to the clients. > At any rate, if we wanted to solve this problem--a self-describing > schema--we should do it in qapi-schema.json too. I disagree. I also disagree that qapi-schema.json, as written, is a format designed for machine consumption. So, qapi-schema.json has to be readable/writable _mostly_ by humans. That it is valid JSON is little more than a curious accident, because overall the syntax greatly favors humans rather than computers. A format designed for computers would have a schema such that no parsing tasks (however small---I'm thinking of the "list of" and "optional" syntaxes) would be left after parsing the JSON. The example that Eric sent is not something that I would find easy to read/write. qapi-schema.json instead is more than acceptable. Paolo