...

Text file src/cuelang.org/go/encoding/protobuf/jsonpb/testdata/decoder/basic.txtar

Documentation: cuelang.org/go/encoding/protobuf/jsonpb/testdata/decoder

     1-- schema.cue --
     2a: int
     3
     4strings: {
     5	c: string
     6	d: "foo" | "bar"
     7}
     8
     9lists: {
    10	e: [...int]
    11	f: [int, int]
    12	g: [int, int, ...int]
    13	h: [int, int]
    14}
    15
    16structs: [string]: {
    17	a: int
    18}
    19-- data.json --
    20{
    21    "a": "44",
    22    "strings": {
    23        "c": "cc",
    24        "d": "foo"
    25    },
    26    "lists": {
    27        "e": ["1"],
    28        "f": ["2"],
    29        "g": ["3", "4", "5"],
    30        "h": ["3", "4", "5"]
    31    },
    32    "structs": {
    33        "field": {
    34            "a": "1",
    35            "b": "2"
    36        }
    37    },
    38    "tail": {}
    39}
    40-- data.cue --
    41a: "44"
    42strings: {
    43	c: "cc"
    44	d: "foo"
    45}
    46lists: {
    47	e: ["1"]
    48	f: ["2"]
    49	g: ["3", "4", "5"]
    50	h: ["3", "4", "5"] // Last element should not be rewritten!
    51}
    52structs: {
    53	field: {
    54		a: "1"
    55		b: "2"
    56	}
    57}
    58tail: {}
    59-- out/jsonpb/data.json --
    60a: 44
    61strings: {
    62	c: "cc"
    63	d: "foo"
    64}
    65lists: {
    66	e: [1]
    67	f: [2]
    68	g: [3, 4, 5]
    69	h: [3, 4, "5"]
    70}
    71structs: {
    72	field: {
    73		a: 1
    74		b: "2"
    75	}
    76}
    77tail: {}
    78-- out/jsonpb/data.cue --
    79a: 44
    80strings: {
    81	c: "cc"
    82	d: "foo"
    83}
    84lists: {
    85	e: [1]
    86	f: [2]
    87	g: [3, 4, 5]
    88	h: [3, 4, "5"] // Last element should not be rewritten!
    89}
    90structs: {
    91	field: {
    92		a: 1
    93		b: "2"
    94	}
    95}
    96tail: {}

View as plain text