Victor Toso <victort...@redhat.com> writes: > The goal of this generator is to validate QAPI examples and transform > them into a format that can be used for 3rd party applications to > validate their QAPI/QMP introspection. > > For each Example section, we parse server and client messages into a > python dictionary. This step alone has found several ill formatted > JSON messages in the examples. > > The generator outputs another JSON file with all the examples in the > QAPI module that they came from. This can be used to validate the > introspection between QAPI/QMP to language bindings. > > When used with the POC qapi-go branch, we have found bad QMP messages > with wrong member names, mandatory members that were missing and > optional members that were being set with null (not needed). > > A simple example of the output format is: > > { "examples": [ > { > "id": "ksuxwzfayw", > "client": [ > { > "sequence-order": 1 > "message-type": "command", > "message": > { "arguments": > { "device": "scratch", "size": 1073741824 }, > "execute": "block_resize" > }, > } ], > "server": [ > { > "sequence-order": 2 > "message-type": "return", > "message": { "return": {} }, > } ] > } > ] } > > If this idea seems reasonable, we can add python-qemu-qmp to validate > each message at generation time already. > > Signed-off-by: Victor Toso <victort...@redhat.com>
If I understand you correctly, there are two benefits: 1. Mechanical syntax check for examples Love it. 2. Can extract examples for use as test cases Sounds good to me. Possible redundancy with existing tests. Probably nothing to worry about. Can you explain in a bit more detail how the extracted data is (to be) used?