summary refs log tree commit diff stats
path: root/tests/qapi-schema/test-qapi.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2025-03-10 23:42:24 -0400
committerMarkus Armbruster <armbru@redhat.com>2025-03-11 10:10:57 +0100
commitef137a224192cf145c8ae207fe96fd77b63596a9 (patch)
tree32607dc43f6ba07508a86adb23a02fb84d63c4ba /tests/qapi-schema/test-qapi.py
parent6a41330206e0df32b93c371b551f89d393eda2c3 (diff)
downloadfocaccia-qemu-ef137a224192cf145c8ae207fe96fd77b63596a9.tar.gz
focaccia-qemu-ef137a224192cf145c8ae207fe96fd77b63596a9.zip
docs/qapi-domain: add warnings for malformed field lists
Normally, Sphinx will silently fall back to its standard field list
processing if it doesn't match one of your defined fields. A lot of the
time, that's not what we want - we want to be warned if we goof
something up.

For instance, the canonical argument field list form is:

:arg type name: descr

This form is captured by Sphinx and transformed so that the field label
will become "Arguments:". It's possible to omit the type name and descr
and still have it be processed correctly. However, if you omit the type
name, Sphinx no longer recognizes it:

:arg: this is not recognized.

This will turn into an arbitrary field list entry whose label is "Arg:",
and it otherwise silently fails. You may also see failures for doing
things like using :values: instead of :value:, or :errors: instead of
:error:, and so on. It's also case sensitive, and easy to trip up.

Add a validator that guarantees all field list entries that are the
direct child of an ObjectDescription use only recognized forms of field
lists, and emit a warning (treated as error by default in most build
configurations) whenever we detect one that is goofed up.

However, there's still benefit to allowing arbitrary fields -- they are
after all not a Sphinx invention, but perfectly normal docutils
syntax. Create an allow list for known spellings we don't mind letting
through, but warn against anything else.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-27-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/test-qapi.py')
0 files changed, 0 insertions, 0 deletions