xref: /qemu/tests/qapi-schema/doc-good.json (revision 5d83b9a1)
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', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
107
108##
109# @SugaredUnion:
110# Features:
111# @union-feat2: a feature
112##
113{ 'union': 'SugaredUnion',
114  'features': [ 'union-feat2' ],
115  'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
116
117##
118# @Alternate:
119# @i: an integer
120#     @b is undocumented
121#
122# Features:
123# @alt-feat: a feature
124##
125{ 'alternate': 'Alternate',
126  'features': [ 'alt-feat' ],
127  'data': { 'i': 'int', 'b': 'bool' } }
128
129##
130# == Another subsection
131##
132
133##
134# @cmd:
135# @arg1: the first argument
136#
137# @arg2: the second
138#        argument
139#
140# Features:
141# @cmd-feat1: a feature
142# @cmd-feat2: another feature
143# Note: @arg3 is undocumented
144# Returns: @Object
145# TODO: frobnicate
146# Notes:
147#
148# - Lorem ipsum dolor sit amet
149# - Ut enim ad minim veniam
150#
151# Duis aute irure dolor
152# Example:
153#
154# -> in
155# <- out
156# Examples:
157# - *verbatim*
158# - {braces}
159# Since: 2.10
160##
161{ 'command': 'cmd',
162  'data': { 'arg1': 'int', '*arg2': 'str', 'arg3': 'bool' },
163  'returns': 'Object',
164  'features': [ 'cmd-feat1', 'cmd-feat2' ] }
165
166##
167# @cmd-boxed:
168# If you're bored enough to read this, go see a video of boxed cats
169# Features:
170# @cmd-feat1: a feature
171# @cmd-feat2: another feature
172# Example:
173#
174# -> in
175#
176# <- out
177##
178{ 'command': 'cmd-boxed', 'boxed': true,
179  'data': 'Object',
180  'features': [ 'cmd-feat1', 'cmd-feat2' ] }
181
182##
183# @EVT_BOXED:
184# Features:
185# @feat3: a feature
186##
187{ 'event': 'EVT_BOXED',  'boxed': true,
188  'features': [ 'feat3' ],
189  'data': 'Object' }
190