...

Text file src/cuelang.org/go/encoding/openapi/testdata/oneof.cue

Documentation: cuelang.org/go/encoding/openapi/testdata

     1// OpenAPI title.
     2
     3$version: "v1alpha1"
     4
     5#T: {
     6	shared: int
     7}
     8#T: {} | {
     9	exact: string
    10} | {
    11	regex: string
    12}
    13#T: {} | {
    14	count: int
    15} | {
    16	amount: int
    17}
    18#T: {
    19	shared2: int
    20}
    21
    22// This should be dedupped.
    23#T: {} | {
    24	count: int
    25} | {
    26	amount: int
    27}
    28
    29#MyInt: int
    30
    31#Foo: {
    32	include: #T
    33	exclude: [...#T]
    34	count: #MyInt
    35}
    36
    37#Incompatible: {
    38	shared: int
    39} | {
    40	shared: int
    41	extra1: int
    42} | {
    43	shared: int
    44	extra2: int
    45}
    46
    47#WithMap: {
    48	shared: [string]: int
    49} | {
    50	shared: [string]: int
    51	extra: int
    52} | {
    53	shared: string // incompatible
    54	extra:  int
    55}
    56
    57#Embed: {
    58	a?: int
    59
    60	close({}) |
    61	close({b: #T}) |
    62	close({c: int})
    63
    64	#T: {b?: int}
    65
    66	close({}) |
    67	close({d: #T}) |
    68	close({e: int})
    69
    70	// TODO: maybe support builtin to write this as
    71	// oneof({},
    72	// {b: int},
    73	// {c: int})
    74}

View as plain text