Hi, I've been using the examples as a way to test the qapi-go proposal [0] and I thought it would be neat to have a way to parse those examples and regenerate them in a way that we could use for testing.
The first 10 patches are fixes to issues found when loading the Example into python's json library. Patches 11-15 are fixes to issues found when using those exampels in the qapi-go module [1]. Patch 16 is the RFC for the generator used. If the idea is interesting, I can rework it and add some qapi/qmp verification of the examples at generation time with python-qemu-qmp [2]. [0] https://lists.nongnu.org/archive/html/qemu-devel/2022-06/msg03105.html [1] https://gitlab.com/victortoso/qapi-go/-/tree/wip-v3/test [2] https://gitlab.com/qemu-project/python-qemu-qmp Cheers, Victor Victor Toso (16): qapi: fix example of query-ballon command qapi: fix example of query-vnc command qapi: fix example of query-spice command qapi: fix example of query-rocker-of-dpa-flows command qapi: fix example of query-dump-guest-memory-capability command qapi: fix example of query-blockstats command qapi: fix example of BLOCK_JOB_READY event qapi: fix example of NIC_RX_FILTER_CHANGED event qapi: fix example of DEVICE_UNPLUG_GUEST_ERROR event qapi: fix example of MEM_UNPLUG_ERROR event qapi: fix examples of blockdev-add with qcow2 qapi: fix example of blockdev-add command qapi: fix example of query-hotpluggable-cpus command qapi: fix example of query-migrate command qapi: fix examples of events missing timestamp RFC: add a generator for qapi's examples qapi/block-core.json | 46 ++++----- qapi/dump.json | 1 + qapi/machine.json | 8 +- qapi/migration.json | 83 +++++++++++++-- qapi/net.json | 2 +- qapi/qdev.json | 3 +- qapi/rocker.json | 3 +- qapi/ui.json | 7 +- scripts/qapi/dumpexamples.py | 194 +++++++++++++++++++++++++++++++++++ scripts/qapi/main.py | 2 + 10 files changed, 304 insertions(+), 45 deletions(-) create mode 100644 scripts/qapi/dumpexamples.py -- 2.37.2