qapi-domain.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. ======================
  2. The Sphinx QAPI Domain
  3. ======================
  4. An extension to the `rST syntax
  5. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_
  6. in Sphinx is provided by the QAPI Domain, located in
  7. ``docs/sphinx/qapi_domain.py``. This extension is analogous to the
  8. `Python Domain
  9. <https://www.sphinx-doc.org/en/master/usage/domains/python.html>`_
  10. included with Sphinx, but provides special directives and roles
  11. speciically for annotating and documenting QAPI definitions
  12. specifically.
  13. A `Domain
  14. <https://www.sphinx-doc.org/en/master/usage/domains/index.html>`_
  15. provides a set of special rST directives and cross-referencing roles to
  16. Sphinx for understanding rST markup written to document a specific
  17. language. By itself, this QAPI extension is only sufficient to parse rST
  18. markup written by hand; the `autodoc
  19. <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
  20. functionality is provided elsewhere, in ``docs/sphinx/qapidoc.py``, by
  21. the "Transmogrifier".
  22. It is not expected that any developer nor documentation writer would
  23. never need to write *nor* read these special rST forms. However, in the
  24. event that something needs to be debugged, knowing the syntax of the
  25. domain is quite handy. This reference may also be useful as a guide for
  26. understanding the QAPI Domain extension code itself. Although most of
  27. these forms will not be needed for documentation writing purposes,
  28. understanding the cross-referencing syntax *will* be helpful when
  29. writing rST documentation elsewhere, or for enriching the body of
  30. QAPIDoc blocks themselves.
  31. Concepts
  32. ========
  33. The QAPI Domain itself provides no mechanisms for reading the QAPI
  34. Schema or generating documentation from code that exists. It is merely
  35. the rST syntax used to describe things. For instance, the Sphinx Python
  36. domain adds syntax like ``:py:func:`` for describing Python functions in
  37. documentation, but it's the autodoc module that is responsible for
  38. reading Python code and generating such syntax. QAPI is analogous here:
  39. qapidoc.py is responsible for reading the QAPI Schema and generating rST
  40. syntax, and qapi_domain.py is responsible for translating that special
  41. syntax and providing APIs for Sphinx internals.
  42. In other words:
  43. qapi_domain.py adds syntax like ``.. qapi:command::`` to Sphinx, and
  44. qapidoc.py transforms the documentation in ``qapi/*.json`` into rST
  45. using directives defined by the domain.
  46. Or even shorter:
  47. ``:py:`` is to ``:qapi:`` as *autodoc* is to *qapidoc*.
  48. Info Field Lists
  49. ================
  50. `Field lists
  51. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists>`_
  52. are a standard syntax in reStructuredText. Sphinx `extends that syntax
  53. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#info-field-lists>`_
  54. to give certain field list entries special meaning and parsing to, for
  55. example, add cross-references. The QAPI Domain takes advantage of this
  56. field list extension to document things like Arguments, Members, Values,
  57. and so on.
  58. The special parsing and handling of info field lists in Sphinx is provided by
  59. three main classes; Field, GroupedField, and TypedField. The behavior
  60. and formatting for each configured field list entry in the domain
  61. changes depending on which class is used.
  62. Field:
  63. * Creates an ungrouped field: i.e., each entry will create its own
  64. section and they will not be combined.
  65. * May *optionally* support an argument.
  66. * May apply cross-reference roles to *either* the argument *or* the
  67. content body, both, or neither.
  68. This is used primarily for entries which are not expected to be
  69. repeated, i.e., items that may only show up at most once. The QAPI
  70. domain uses this class for "Errors" section.
  71. GroupedField:
  72. * Creates a grouped field: i.e. multiple adjacent entries will be
  73. merged into one section, and the content will form a bulleted list.
  74. * *Must* take an argument.
  75. * May optionally apply a cross-reference role to the argument, but not
  76. the body.
  77. * Can be configured to remove the bulleted list if there is only a
  78. single entry.
  79. * All items will be generated with the form: "argument -- body"
  80. This is used for entries which are expected to be repeated, but aren't
  81. expected to have two arguments, i.e. types without names, or names
  82. without types. The QAPI domain uses this class for features, returns,
  83. and enum values.
  84. TypedField:
  85. * Creates a grouped, typed field. Multiple adjacent entres will be
  86. merged into one section, and the content will form a bulleted list.
  87. * *Must* take at least one argument, but supports up to two -
  88. nominally, a name and a type.
  89. * May optionally apply a cross-reference role to the type or the name
  90. argument, but not the body.
  91. * Can be configured to remove the bulleted list if there is only a
  92. single entry.
  93. * All items will be generated with the form "name (type) -- body"
  94. This is used for entries that are expected to be repeated and will have
  95. a name, a type, and a description. The QAPI domain uses this class for
  96. arguments, alternatives, and members. Wherever type names are referenced
  97. below, They must be a valid, documented type that will be
  98. cross-referenced in the HTML output; or one of the built-in JSON types
  99. (string, number, int, boolean, null, value, q_empty).
  100. ``:feat:``
  101. ----------
  102. Document a feature attached to a QAPI definition.
  103. :availability: This field list is available in the body of Command,
  104. Event, Enum, Object and Alternate directives.
  105. :syntax: ``:feat name: Lorem ipsum, dolor sit amet...``
  106. :type: `sphinx.util.docfields.GroupedField
  107. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  108. Example::
  109. .. qapi:object:: BlockdevOptionsVirtioBlkVhostVdpa
  110. :since: 7.2
  111. :ifcond: CONFIG_BLKIO
  112. Driver specific block device options for the virtio-blk-vhost-vdpa
  113. backend.
  114. :memb string path: path to the vhost-vdpa character device.
  115. :feat fdset: Member ``path`` supports the special "/dev/fdset/N" path
  116. (since 8.1)
  117. ``:arg:``
  118. ---------
  119. Document an argument to a QAPI command.
  120. :availability: This field list is only available in the body of the
  121. Command directive.
  122. :syntax: ``:arg type name: description``
  123. :type: `sphinx.util.docfields.TypedField
  124. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  125. Example::
  126. .. qapi:command:: job-pause
  127. :since: 3.0
  128. Pause an active job.
  129. This command returns immediately after marking the active job for
  130. pausing. Pausing an already paused job is an error.
  131. The job will pause as soon as possible, which means transitioning
  132. into the PAUSED state if it was RUNNING, or into STANDBY if it was
  133. READY. The corresponding JOB_STATUS_CHANGE event will be emitted.
  134. Cancelling a paused job automatically resumes it.
  135. :arg string id: The job identifier.
  136. ``:error:``
  137. -----------
  138. Document the error condition(s) of a QAPI command.
  139. :availability: This field list is only available in the body of the
  140. Command directive.
  141. :syntax: ``:error: Lorem ipsum dolor sit amet ...``
  142. :type: `sphinx.util.docfields.Field
  143. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.Field.html?private=1>`_
  144. The format of the :errors: field list description is free-form rST. The
  145. alternative spelling ":errors:" is also permitted, but strictly
  146. analogous.
  147. Example::
  148. .. qapi:command:: block-job-set-speed
  149. :since: 1.1
  150. Set maximum speed for a background block operation.
  151. This command can only be issued when there is an active block job.
  152. Throttling can be disabled by setting the speed to 0.
  153. :arg string device: The job identifier. This used to be a device
  154. name (hence the name of the parameter), but since QEMU 2.7 it
  155. can have other values.
  156. :arg int speed: the maximum speed, in bytes per second, or 0 for
  157. unlimited. Defaults to 0.
  158. :error:
  159. - If no background operation is active on this device,
  160. DeviceNotActive
  161. ``:return:``
  162. -------------
  163. Document the return type(s) and value(s) of a QAPI command.
  164. :availability: This field list is only available in the body of the
  165. Command directive.
  166. :syntax: ``:return type: Lorem ipsum dolor sit amet ...``
  167. :type: `sphinx.util.docfields.GroupedField
  168. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  169. Example::
  170. .. qapi:command:: query-replay
  171. :since: 5.2
  172. Retrieve the record/replay information. It includes current
  173. instruction count which may be used for ``replay-break`` and
  174. ``replay-seek`` commands.
  175. :return ReplayInfo: record/replay information.
  176. .. qmp-example::
  177. -> { "execute": "query-replay" }
  178. <- { "return": {
  179. "mode": "play", "filename": "log.rr", "icount": 220414 }
  180. }
  181. ``:value:``
  182. -----------
  183. Document a possible value for a QAPI enum.
  184. :availability: This field list is only available in the body of the Enum
  185. directive.
  186. :syntax: ``:value name: Lorem ipsum, dolor sit amet ...``
  187. :type: `sphinx.util.docfields.GroupedField
  188. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  189. Example::
  190. .. qapi:enum:: QapiErrorClass
  191. :since: 1.2
  192. QEMU error classes
  193. :value GenericError: this is used for errors that don't require a specific
  194. error class. This should be the default case for most errors
  195. :value CommandNotFound: the requested command has not been found
  196. :value DeviceNotActive: a device has failed to be become active
  197. :value DeviceNotFound: the requested device has not been found
  198. :value KVMMissingCap: the requested operation can't be fulfilled because a
  199. required KVM capability is missing
  200. ``:alt:``
  201. ------------
  202. Document a possible branch for a QAPI alternate.
  203. :availability: This field list is only available in the body of the
  204. Alternate directive.
  205. :syntax: ``:alt type name: Lorem ipsum, dolor sit amet ...``
  206. :type: `sphinx.util.docfields.TypedField
  207. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  208. As a limitation of Sphinx, we must document the "name" of the branch in
  209. addition to the type, even though this information is not visible on the
  210. wire in the QMP protocol format. This limitation *may* be lifted at a
  211. future date.
  212. Example::
  213. .. qapi:alternate:: StrOrNull
  214. :since: 2.10
  215. This is a string value or the explicit lack of a string (null
  216. pointer in C). Intended for cases when 'optional absent' already
  217. has a different meaning.
  218. :alt string s: the string value
  219. :alt null n: no string value
  220. ``:memb:``
  221. ----------
  222. Document a member of an Event or Object.
  223. :availability: This field list is available in the body of Event or
  224. Object directives.
  225. :syntax: ``:memb type name: Lorem ipsum, dolor sit amet ...``
  226. :type: `sphinx.util.docfields.TypedField
  227. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  228. This is fundamentally the same as ``:arg:`` and ``:alt:``, but uses the
  229. "Members" phrasing for Events and Objects (Structs and Unions).
  230. Example::
  231. .. qapi:event:: JOB_STATUS_CHANGE
  232. :since: 3.0
  233. Emitted when a job transitions to a different status.
  234. :memb string id: The job identifier
  235. :memb JobStatus status: The new job status
  236. Arbitrary field lists
  237. ---------------------
  238. Other field list names, while valid rST syntax, are prohibited inside of
  239. QAPI directives to help prevent accidental misspellings of info field
  240. list names. If you want to add a new arbitrary "non-value-added" field
  241. list to QAPI documentation, you must add the field name to the allow
  242. list in ``docs/conf.py``
  243. For example::
  244. qapi_allowed_fields = {
  245. "see also",
  246. }
  247. Will allow you to add arbitrary field lists in QAPI directives::
  248. .. qapi:command:: x-fake-command
  249. :see also: Lorem ipsum, dolor sit amet ...
  250. Cross-references
  251. ================
  252. Cross-reference `roles
  253. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_
  254. in the QAPI domain are modeled closely after the `Python
  255. cross-referencing syntax
  256. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#cross-referencing-python-objects>`_.
  257. QAPI definitions can be referenced using the standard `any
  258. <https://www.sphinx-doc.org/en/master/usage/referencing.html#role-any>`_
  259. role cross-reference syntax, such as with ```query-blockstats```. In
  260. the event that disambiguation is needed, cross-references can also be
  261. written using a number of explicit cross-reference roles:
  262. * ``:qapi:mod:`block-core``` -- Reference a QAPI module. The link will
  263. take you to the beginning of that section in the documentation.
  264. * ``:qapi:cmd:`query-block``` -- Reference a QAPI command.
  265. * ``:qapi:event:`JOB_STATUS_CHANGE``` -- Reference a QAPI event.
  266. * ``:qapi:enum:`QapiErrorClass``` -- Reference a QAPI enum.
  267. * ``:qapi:obj:`BlockdevOptionsVirtioBlkVhostVdpa`` -- Reference a QAPI
  268. object (struct or union)
  269. * ``:qapi:alt:`StrOrNull``` -- Reference a QAPI alternate.
  270. * ``:qapi:type:`BlockDirtyInfo``` -- Reference *any* QAPI type; this
  271. excludes modules, commands, and events.
  272. * ``:qapi:any:`block-job-set-speed``` -- Reference absolutely any QAPI entity.
  273. Type arguments in info field lists are converted into references as if
  274. you had used the ``:qapi:type:`` role. All of the special syntax below
  275. applies to both info field lists and standalone explicit
  276. cross-references.
  277. Type decorations
  278. ----------------
  279. Type names in references can be surrounded by brackets, like
  280. ``[typename]``, to indicate an array of that type. The cross-reference
  281. will apply only to the type name between the brackets. For example;
  282. ``:qapi:type:`[Qcow2BitmapInfoFlags]``` renders to:
  283. :qapi:type:`[QMP:Qcow2BitmapInfoFlags]`
  284. To indicate an optional argument/member in a field list, the type name
  285. can be suffixed with ``?``. The cross-reference will be transformed to
  286. "type, Optional" with the link applying only to the type name. For
  287. example; ``:qapi:type:`BitmapSyncMode?``` renders to:
  288. :qapi:type:`QMP:BitmapSyncMode?`
  289. Namespaces
  290. ----------
  291. Mimicking the `Python domain target specification syntax
  292. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#target-specification>`_,
  293. QAPI allows you to specify the fully qualified path for a data
  294. type.
  295. * A namespace can be explicitly provided;
  296. e.g. ``:qapi:type:`QMP:BitmapSyncMode``
  297. * A module can be explicitly provided;
  298. ``:qapi:type:`QMP:block-core.BitmapSyncMode``` will render to:
  299. :qapi:type:`QMP:block-core.BitmapSyncMode`
  300. * If you don't want to display the "fully qualified" name, it can be
  301. prefixed with a tilde; ``:qapi:type:`~QMP:block-core.BitmapSyncMode```
  302. will render to: :qapi:type:`~QMP:block-core.BitmapSyncMode`
  303. Target resolution
  304. -----------------
  305. Any cross-reference to a QAPI type, whether using the ```any``` style of
  306. reference or the more explicit ```:qapi:any:`target``` syntax, allows
  307. for the presence or absence of either the namespace or module
  308. information.
  309. When absent, their value will be inferred from context by the presence
  310. of any ``qapi:namespace`` or ``qapi:module`` directives preceding the
  311. cross-reference.
  312. If no results are found when using the inferred values, other
  313. namespaces/modules will be searched as a last resort; but any explicitly
  314. provided values must always match in order to succeed.
  315. This allows for efficient cross-referencing with a minimum of syntax in
  316. the large majority of cases, but additional context or namespace markup
  317. may be required outside of the QAPI reference documents when linking to
  318. items that share a name across multiple documented QAPI schema.
  319. Custom link text
  320. ----------------
  321. The name of a cross-reference link can be explicitly overridden like
  322. `most stock Sphinx references
  323. <https://www.sphinx-doc.org/en/master/usage/referencing.html#syntax>`_
  324. using the ``custom text <target>`` syntax.
  325. For example, ``:qapi:cmd:`Merge dirty bitmaps
  326. <block-dirty-bitmap-merge>``` will render as: :qapi:cmd:`Merge dirty
  327. bitmaps <QMP:block-dirty-bitmap-merge>`
  328. Directives
  329. ==========
  330. The QAPI domain adds a number of custom directives for documenting
  331. various QAPI/QMP entities. The syntax is plain rST, and follows this
  332. general format::
  333. .. qapi:directive:: argument
  334. :option:
  335. :another-option: with an argument
  336. Content body, arbitrary rST is allowed here.
  337. Sphinx standard options
  338. -----------------------
  339. All QAPI directives inherit a number of `standard options
  340. <https://www.sphinx-doc.org/en/master/usage/domains/index.html#basic-markup>`_
  341. from Sphinx's ObjectDescription class.
  342. The dashed spellings of the below options were added in Sphinx 7.2, the
  343. undashed spellings are currently retained as aliases, but will be
  344. removed in a future version.
  345. * ``:no-index:`` and ``:noindex:`` -- Do not add this item into the
  346. Index, and do not make it available for cross-referencing.
  347. * ``no-index-entry:`` and ``:noindexentry:`` -- Do not add this item
  348. into the Index, but allow it to be cross-referenced.
  349. * ``no-contents-entry`` and ``:nocontentsentry:`` -- Exclude this item
  350. from the Table of Contents.
  351. * ``no-typesetting`` -- Create TOC, Index and cross-referencing
  352. entities, but don't actually display the content.
  353. QAPI standard options
  354. ---------------------
  355. All QAPI directives -- *except* for namespace and module -- support
  356. these common options.
  357. * ``:namespace: name`` -- This option allows you to override the
  358. namespace association of a given definition.
  359. * ``:module: modname`` -- Borrowed from the Python domain, this option allows
  360. you to override the module association of a given definition.
  361. * ``:since: x.y`` -- Allows the documenting of "Since" information, which is
  362. displayed in the signature bar.
  363. * ``:ifcond: CONDITION`` -- Allows the documenting of conditional availability
  364. information, which is displayed in an eyecatch just below the
  365. signature bar.
  366. * ``:deprecated:`` -- Adds an eyecatch just below the signature bar that
  367. advertises that this definition is deprecated and should be avoided.
  368. * ``:unstable:`` -- Adds an eyecatch just below the signature bar that
  369. advertises that this definition is unstable and should not be used in
  370. production code.
  371. qapi:namespace
  372. --------------
  373. The ``qapi:namespace`` directive marks the start of a QAPI namespace. It
  374. does not take a content body, nor any options. All subsequent QAPI
  375. directives are associated with the most recent namespace. This affects
  376. the definition's "fully qualified name", allowing two different
  377. namespaces to create an otherwise identically named definition.
  378. This directive also influences how reference resolution works for any
  379. references that do not explicitly specify a namespace, so this directive
  380. can be used to nudge references into preferring targets from within that
  381. namespace.
  382. Example::
  383. .. qapi:namespace:: QMP
  384. This directive has no visible effect.
  385. qapi:module
  386. -----------
  387. The ``qapi:module`` directive marks the start of a QAPI module. It may have
  388. a content body, but it can be omitted. All subsequent QAPI directives
  389. are associated with the most recent module; this effects their "fully
  390. qualified" name, but has no other effect.
  391. Example::
  392. .. qapi:module:: block-core
  393. Welcome to the block-core module!
  394. Will be rendered as:
  395. .. qapi:module:: block-core
  396. :noindex:
  397. Welcome to the block-core module!
  398. qapi:command
  399. ------------
  400. This directive documents a QMP command. It may use any of the standard
  401. Sphinx or QAPI options, and the documentation body may contain
  402. ``:arg:``, ``:feat:``, ``:error:``, or ``:return:`` info field list
  403. entries.
  404. Example::
  405. .. qapi:command:: x-fake-command
  406. :since: 42.0
  407. :unstable:
  408. This command is fake, so it can't hurt you!
  409. :arg int foo: Your favorite number.
  410. :arg string? bar: Your favorite season.
  411. :return [string]: A lovely computer-written poem for you.
  412. Will be rendered as:
  413. .. qapi:command:: x-fake-command
  414. :noindex:
  415. :since: 42.0
  416. :unstable:
  417. This command is fake, so it can't hurt you!
  418. :arg int foo: Your favorite number.
  419. :arg string? bar: Your favorite season.
  420. :return [string]: A lovely computer-written poem for you.
  421. qapi:event
  422. ----------
  423. This directive documents a QMP event. It may use any of the standard
  424. Sphinx or QAPI options, and the documentation body may contain
  425. ``:memb:`` or ``:feat:`` info field list entries.
  426. Example::
  427. .. qapi:event:: COMPUTER_IS_RUINED
  428. :since: 0.1
  429. :deprecated:
  430. This event is emitted when your computer is *extremely* ruined.
  431. :memb string reason: Diagnostics as to what caused your computer to
  432. be ruined.
  433. :feat sadness: When present, the diagnostic message will also
  434. explain how sad the computer is as a result of your wrongdoings.
  435. Will be rendered as:
  436. .. qapi:event:: COMPUTER_IS_RUINED
  437. :noindex:
  438. :since: 0.1
  439. :deprecated:
  440. This event is emitted when your computer is *extremely* ruined.
  441. :memb string reason: Diagnostics as to what caused your computer to
  442. be ruined.
  443. :feat sadness: When present, the diagnostic message will also explain
  444. how sad the computer is as a result of your wrongdoings.
  445. qapi:enum
  446. ---------
  447. This directive documents a QAPI enum. It may use any of the standard
  448. Sphinx or QAPI options, and the documentation body may contain
  449. ``:value:`` or ``:feat:`` info field list entries.
  450. Example::
  451. .. qapi:enum:: Mood
  452. :ifcond: LIB_PERSONALITY
  453. This enum represents your virtual machine's current mood!
  454. :value Happy: Your VM is content and well-fed.
  455. :value Hungry: Your VM needs food.
  456. :value Melancholic: Your VM is experiencing existential angst.
  457. :value Petulant: Your VM is throwing a temper tantrum.
  458. Will be rendered as:
  459. .. qapi:enum:: Mood
  460. :noindex:
  461. :ifcond: LIB_PERSONALITY
  462. This enum represents your virtual machine's current mood!
  463. :value Happy: Your VM is content and well-fed.
  464. :value Hungry: Your VM needs food.
  465. :value Melancholic: Your VM is experiencing existential angst.
  466. :value Petulant: Your VM is throwing a temper tantrum.
  467. qapi:object
  468. -----------
  469. This directive documents a QAPI structure or union and represents a QMP
  470. object. It may use any of the standard Sphinx or QAPI options, and the
  471. documentation body may contain ``:memb:`` or ``:feat:`` info field list
  472. entries.
  473. Example::
  474. .. qapi:object:: BigBlobOfStuff
  475. This object has a bunch of disparate and unrelated things in it.
  476. :memb int Birthday: Your birthday, represented in seconds since the
  477. UNIX epoch.
  478. :memb [string] Fav-Foods: A list of your favorite foods.
  479. :memb boolean? Bizarre-Docs: True if the documentation reference
  480. should be strange.
  481. Will be rendered as:
  482. .. qapi:object:: BigBlobOfStuff
  483. :noindex:
  484. This object has a bunch of disparate and unrelated things in it.
  485. :memb int Birthday: Your birthday, represented in seconds since the
  486. UNIX epoch.
  487. :memb [string] Fav-Foods: A list of your favorite foods.
  488. :memb boolean? Bizarre-Docs: True if the documentation reference
  489. should be strange.
  490. qapi:alternate
  491. --------------
  492. This directive documents a QAPI alternate. It may use any of the
  493. standard Sphinx or QAPI options, and the documentation body may contain
  494. ``:alt:`` or ``:feat:`` info field list entries.
  495. Example::
  496. .. qapi:alternate:: ErrorCode
  497. This alternate represents an Error Code from the VM.
  498. :alt int ec: An error code, like the type you're used to.
  499. :alt string em: An expletive-laced error message, if your
  500. computer is feeling particularly cranky and tired of your
  501. antics.
  502. Will be rendered as:
  503. .. qapi:alternate:: ErrorCode
  504. :noindex:
  505. This alternate represents an Error Code from the VM.
  506. :alt int ec: An error code, like the type you're used to.
  507. :alt string em: An expletive-laced error message, if your
  508. computer is feeling particularly cranky and tired of your
  509. antics.