qapi: fix non-compliant JSON examples

The new QMP documentation generator wants to parse all examples as
"QMP". We have an existing QMP lexer in docs/sphinx/qmp_lexer.py (Seen
in-use here: https://qemu-project.gitlab.io/qemu/interop/bitmaps.html)
that allows the use of "->", "<-" and "..." tokens to denote QMP
protocol flow with elisions, but otherwise defers to the JSON lexer.

To utilize this lexer for the existing QAPI documentation, we need them
to conform to a standard so that they lex and render correctly. Once the
QMP lexer is active for examples, errant QMP/JSON will produce warning
messages and fail the build.

Fix any invalid JSON found in QAPI documentation (identified by
attempting to lex all examples as QMP; see subsequent
commits). Additionally, elisions must be standardized for the QMP lexer;
they must be represented as the value "...", so three examples have been
adjusted to support that format here.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240626222128.406106-9-jsnow@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
John Snow 2024-06-26 18:21:14 -04:00 committed by Markus Armbruster
parent 2664f3176a
commit 9f2b848857
7 changed files with 11 additions and 9 deletions

View File

@ -145,7 +145,8 @@
# }, # },
# { # {
# "name":"system_powerdown" # "name":"system_powerdown"
# } # },
# ...
# ] # ]
# } # }
# #

View File

@ -1057,7 +1057,7 @@
# "vcpus-count": 1 }, # "vcpus-count": 1 },
# { "props": { "core-id": 0 }, "type": "POWER8-spapr-cpu-core", # { "props": { "core-id": 0 }, "type": "POWER8-spapr-cpu-core",
# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} # "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
# ]}' # ]}
# #
# For pc machine type started with -smp 1,maxcpus=2: # For pc machine type started with -smp 1,maxcpus=2:
# #

View File

@ -2106,7 +2106,7 @@
# Example: # Example:
# #
# -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1, # -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
# 'sample-pages': 512} } # "sample-pages": 512} }
# <- { "return": {} } # <- { "return": {} }
# #
# Measure dirty rate using dirty bitmap for 500 milliseconds: # Measure dirty rate using dirty bitmap for 500 milliseconds:

View File

@ -287,7 +287,8 @@
# #
# Example: # Example:
# #
# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..", fdname": "skclient" } } # -> { "execute": "get-win32-socket",
# "arguments": { "info": "abcd123..", "fdname": "skclient" } }
# <- { "return": {} } # <- { "return": {} }
## ##
{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' } { 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }

View File

@ -1003,9 +1003,9 @@
# #
# Example: # Example:
# #
# <- { 'event': 'NETDEV_STREAM_DISCONNECTED', # <- { "event": "NETDEV_STREAM_DISCONNECTED",
# 'data': {'netdev-id': 'netdev0'}, # "data": {"netdev-id": "netdev0"},
# 'timestamp': {'seconds': 1663330937, 'microseconds': 526695} } # "timestamp": {"seconds": 1663330937, "microseconds": 526695} }
## ##
{ 'event': 'NETDEV_STREAM_DISCONNECTED', { 'event': 'NETDEV_STREAM_DISCONNECTED',
'data': { 'netdev-id': 'str' } } 'data': { 'netdev-id': 'str' } }

View File

@ -250,7 +250,7 @@
# "action": {"goto-tbl": 10}, # "action": {"goto-tbl": 10},
# "mask": {"in-pport": 4294901760} # "mask": {"in-pport": 4294901760}
# }, # },
# {...more...}, # {...},
# ]} # ]}
## ##
{ 'command': 'query-rocker-of-dpa-flows', { 'command': 'query-rocker-of-dpa-flows',

View File

@ -361,7 +361,7 @@
# "channel-id": 0, # "channel-id": 0,
# "tls": false # "tls": false
# }, # },
# [ ... more channels follow ... ] # ...
# ] # ]
# } # }
# } # }