Switch to unified view

a b/third_party/nucleus/protos/struct.proto
1
// Copyright 2018 Google LLC.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions
5
// are met:
6
//
7
// 1. Redistributions of source code must retain the above copyright notice,
8
//    this list of conditions and the following disclaimer.
9
//
10
// 2. Redistributions in binary form must reproduce the above copyright
11
//    notice, this list of conditions and the following disclaimer in the
12
//    documentation and/or other materials provided with the distribution.
13
//
14
// 3. Neither the name of the copyright holder nor the names of its
15
//    contributors may be used to endorse or promote products derived from this
16
//    software without specific prior written permission.
17
//
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
// POSSIBILITY OF SUCH DAMAGE.
29
30
syntax = "proto3";
31
32
package nucleus.genomics.v1;
33
34
// `Struct` represents a structured data value, consisting of fields
35
// which map to dynamically typed values. In some languages, `Struct`
36
// might be supported by a native representation. For example, in
37
// scripting languages like JS a struct is represented as an
38
// object. The details of that representation are described together
39
// with the proto support for the language.
40
//
41
// The JSON representation for `Struct` is JSON object.
42
message Struct {
43
  // Unordered map of dynamically typed values.
44
  map<string, Value> fields = 1;
45
}
46
47
// `Value` represents a dynamically typed value which can be either
48
// null, a number, a string, a boolean, a recursive struct value, or a
49
// list of values. A producer of value is expected to set one of that
50
// variants, absence of any variant indicates an error.
51
//
52
// The JSON representation for `Value` is JSON value.
53
message Value {
54
  // The kind of value.
55
  oneof kind {
56
    // Represents a null value.
57
    NullValue null_value = 1;
58
59
    // Represents a double value.
60
    double number_value = 2;
61
62
    // Represents an integer value.
63
    int32 int_value = 7;
64
65
    // Represents a string value.
66
    string string_value = 3;
67
68
    // Represents a boolean value.
69
    bool bool_value = 4;
70
71
    // Represents a structured value.
72
    Struct struct_value = 5;
73
74
    // Represents a repeated `Value`.
75
    ListValue list_value = 6;
76
  }
77
}
78
79
// `NullValue` is a singleton enumeration to represent the null value for the
80
// `Value` type union.
81
//
82
//  The JSON representation for `NullValue` is JSON `null`.
83
enum NullValue {
84
  // Null value.
85
  NULL_VALUE = 0;
86
}
87
88
// `ListValue` is a wrapper around a repeated field of values.
89
//
90
// The JSON representation for `ListValue` is JSON array.
91
message ListValue {
92
  // Repeated field of dynamically typed values.
93
  repeated Value values = 1;
94
}