Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- scripts/qapi2texi.py | 5 +++-- tests/qapi-schema/doc-good.json | 4 ++-- tests/qapi-schema/doc-good.out | 3 +++ tests/qapi-schema/doc-good.texi | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index d760596ce0..d8a0379c52 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -165,8 +165,9 @@ def texi_members(doc, what, base, variants, member_func): items += '@item The members of @code{%s}\n' % base.doc_type() if variants: for v in variants.variants: - when = ' when @code{%s} is @t{"%s"}' % ( - variants.tag_member.name, v.name) + when = ' when @code{%s} is @t{"%s"}%s' % ( + variants.tag_member.name, v.name, + ' (@b{If:} @code{%s})' % v.ifcond if v.ifcond else '') if v.type.is_implicit(): assert not v.type.base and not v.type.variants for m in v.type.local_members: diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json index 158443b1a3..afe46d93f0 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -86,13 +86,13 @@ { 'union': 'Object', 'base': 'Base', 'discriminator': 'base1', - 'data': { 'one': 'Variant1', 'two': 'Variant2' } } + 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } } ## # @SugaredUnion: ## { 'union': 'SugaredUnion', - 'data': { 'one': 'Variant1', 'two': 'Variant2' } } + 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } } ## # == Another subsection diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 972b58c815..9a9d745f8e 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -10,6 +10,7 @@ object Object tag base1 case one: Variant1 case two: Variant2 + if ['IFTWO'] enum QType prefix QTYPE member none @@ -24,9 +25,11 @@ object SugaredUnion tag type case one: q_obj_Variant1-wrapper case two: q_obj_Variant2-wrapper + if ['IFTWO'] enum SugaredUnionKind member one member two + if ['IFTWO'] object Variant1 member var1: str optional=False if ['defined(IFSTR)'] diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi index f2a902a06b..3d513a89b7 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -143,7 +143,7 @@ Not documented @table @asis @item The members of @code{Base} @item The members of @code{Variant1} when @code{base1} is @t{"one"} -@item The members of @code{Variant2} when @code{base1} is @t{"two"} +@item The members of @code{Variant2} when @code{base1} is @t{"two"} (@b{If:} @code{['IFTWO']}) @end table @end deftp @@ -159,7 +159,7 @@ Not documented @item @code{type} One of @t{"one"}, @t{"two"} @item @code{data: Variant1} when @code{type} is @t{"one"} -@item @code{data: Variant2} when @code{type} is @t{"two"} +@item @code{data: Variant2} when @code{type} is @t{"two"} (@b{If:} @code{['IFTWO']}) @end table @end deftp -- 2.16.0.rc1.1.gef27df75a1