xref: /openbmc/qemu/tests/qapi-schema/doc-good.json (revision 013b4efc9be9af8276bd891cd52267d409f1d712)
1# -*- Mode: Python -*-
2# Positive QAPI doc comment tests
3
4{ 'pragma': { 'doc-required': true } }
5
6##
7# = Section
8#
9# == Subsection
10#
11# *strong* _with emphasis_
12# @var {in braces}
13# * List item one
14# - Two, multiple
15#   lines
16#
17# 3. Three
18# Still in list
19#
20#   Not in list
21# - Second list
22# Note: still in list
23#
24# Note: not in list
25# 1. Third list
26#    is numbered
27#
28# - another item
29#
30# | example
31# | multiple lines
32#
33# Returns: the King
34# Since: the first age
35# Notes:
36#
37# 1. Lorem ipsum dolor sit amet
38#
39# 2. Ut enim ad minim veniam
40#
41# Duis aute irure dolor
42#
43# Example:
44#
45# -> in
46# <- out
47# Examples:
48# - *verbatim*
49# - {braces}
50##
51
52##
53# @Enum:
54# @one: The _one_ {and only}
55#
56# Features:
57# @enum-feat: Also _one_ {and only}
58#
59# @two is undocumented
60##
61{ 'enum': 'Enum', 'data':
62  [ { 'name': 'one', 'if': 'defined(IFONE)' }, 'two' ],
63  'features': [ 'enum-feat' ],
64  'if': 'defined(IFCOND)' }
65
66##
67# @Base:
68# @base1:
69#   the first member
70##
71{ 'struct': 'Base', 'data': { 'base1': 'Enum' } }
72
73##
74# @Variant1:
75# A paragraph
76#
77# Another paragraph (but no @var: line)
78#
79# Features:
80# @variant1-feat: a feature
81##
82{ 'struct': 'Variant1',
83  'features': [ 'variant1-feat' ],
84  'data': { 'var1': { 'type': 'str', 'if': 'defined(IFSTR)' } } }
85
86##
87# @Variant2:
88##
89{ 'struct': 'Variant2', 'data': {} }
90
91##
92# @Object:
93# Features:
94# @union-feat1: a feature
95##
96{ 'union': 'Object',
97  'features': [ 'union-feat1' ],
98  'base': 'Base',
99  'discriminator': 'base1',
100  'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
101
102##
103# @SugaredUnion:
104# Features:
105# @union-feat2: a feature
106##
107{ 'union': 'SugaredUnion',
108  'features': [ 'union-feat2' ],
109  'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
110
111##
112# @Alternate:
113# @i: an integer
114# @b is undocumented
115#
116# Features:
117# @alt-feat: a feature
118##
119{ 'alternate': 'Alternate',
120  'features': [ 'alt-feat' ],
121  'data': { 'i': 'int', 'b': 'bool' } }
122
123##
124# == Another subsection
125##
126
127##
128# @cmd:
129# @arg1: the first argument
130#
131# @arg2: the second
132# argument
133#
134# Features:
135# @cmd-feat1: a feature
136# @cmd-feat2: another feature
137# Note: @arg3 is undocumented
138# Returns: @Object
139# TODO: frobnicate
140# Notes:
141# - Lorem ipsum dolor sit amet
142# - Ut enim ad minim veniam
143#
144# Duis aute irure dolor
145# Example:
146#
147# -> in
148# <- out
149# Examples:
150# - *verbatim*
151# - {braces}
152# Since: 2.10
153##
154{ 'command': 'cmd',
155  'data': { 'arg1': 'int', '*arg2': 'str', 'arg3': 'bool' },
156  'returns': 'Object',
157  'features': [ 'cmd-feat1', 'cmd-feat2' ] }
158
159##
160# @cmd-boxed:
161# If you're bored enough to read this, go see a video of boxed cats
162# Features:
163# @cmd-feat1: a feature
164# @cmd-feat2: another feature
165# Example:
166#
167# -> in
168#
169# <- out
170##
171{ 'command': 'cmd-boxed', 'boxed': true,
172  'data': 'Object',
173  'features': [ 'cmd-feat1', 'cmd-feat2' ] }
174
175##
176# @EVT-BOXED:
177# Features:
178# @feat3: a feature
179##
180{ 'event': 'EVT-BOXED',  'boxed': true,
181  'features': [ 'feat3' ],
182  'data': 'Object' }
183