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