112 lines
4.2 KiB
Protocol Buffer
112 lines
4.2 KiB
Protocol Buffer
// Protocol Buffers - Google's data interchange format
|
|||
|
|
// Copyright 2008 Google Inc. All rights reserved.
|
||
|
|
// https://developers.google.com/protocol-buffers/
|
||
|
|
//
|
||
|
|
// Redistribution and use in source and binary forms, with or without
|
||
|
|
// modification, are permitted provided that the following conditions are
|
||
|
|
// met:
|
||
|
|
//
|
||
|
|
// * Redistributions of source code must retain the above copyright
|
||
|
|
// notice, this list of conditions and the following disclaimer.
|
||
|
|
// * Redistributions in binary form must reproduce the above
|
||
|
|
// copyright notice, this list of conditions and the following disclaimer
|
||
|
|
// in the documentation and/or other materials provided with the
|
||
|
|
// distribution.
|
||
|
|
// * Neither the name of Google Inc. nor the names of its
|
||
|
|
// contributors may be used to endorse or promote products derived from
|
||
|
|
// this software without specific prior written permission.
|
||
|
|
//
|
||
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
|
|
||
|
|
syntax = "proto3";
|
||
|
|
|
||
|
|
package google.protobuf;
|
||
|
|
|
||
|
|
option cc_enable_arenas = true;
|
||
|
|
option go_package = "google.golang.org/protobuf/types/known/structpb";
|
||
|
|
option java_package = "com.google.protobuf";
|
||
|
|
option java_outer_classname = "StructProto";
|
||
|
|
option java_multiple_files = true;
|
||
|
|
option objc_class_prefix = "GPB";
|
||
|
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||
|
|
|
||
|
|
// Represents a JSON object.
|
||
|
|
//
|
||
|
|
// An unordered key-value map, intending to perfectly capture the semantics of a
|
||
|
|
// JSON object. This enables parsing any arbitrary JSON payload as a message
|
||
|
|
// field in ProtoJSON format.
|
||
|
|
//
|
||
|
|
// This follows RFC 8259 guidelines for interoperable JSON: notably this type
|
||
|
|
// cannot represent large Int64 values or `NaN`/`Infinity` numbers,
|
||
|
|
// since the JSON format generally does not support those values in its number
|
||
|
|
// type.
|
||
|
|
//
|
||
|
|
// If you do not intend to parse arbitrary JSON into your message, a custom
|
||
|
|
// typed message should be preferred instead of using this type.
|
||
|
|
message Struct {
|
||
|
|
// Unordered map of dynamically typed values.
|
||
|
|
map<string, Value> fields = 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Represents a JSON value.
|
||
|
|
//
|
||
|
|
// `Value` represents a dynamically typed value which can be either
|
||
|
|
// null, a number, a string, a boolean, a recursive struct value, or a
|
||
|
|
// list of values. A producer of value is expected to set one of these
|
||
|
|
// variants. Absence of any variant is an invalid state.
|
||
|
|
message Value {
|
||
|
|
// The kind of value.
|
||
|
|
oneof kind {
|
||
|
|
// Represents a JSON `null`.
|
||
|
|
NullValue null_value = 1;
|
||
|
|
|
||
|
|
// Represents a JSON number. Must not be `NaN`, `Infinity` or
|
||
|
|
// `-Infinity`, since those are not supported in JSON. This also cannot
|
||
|
|
// represent large Int64 values, since JSON format generally does not
|
||
|
|
// support them in its number type.
|
||
|
|
double number_value = 2;
|
||
|
|
|
||
|
|
// Represents a JSON string.
|
||
|
|
string string_value = 3;
|
||
|
|
|
||
|
|
// Represents a JSON boolean (`true` or `false` literal in JSON).
|
||
|
|
bool bool_value = 4;
|
||
|
|
|
||
|
|
// Represents a JSON object.
|
||
|
|
Struct struct_value = 5;
|
||
|
|
|
||
|
|
// Represents a JSON array.
|
||
|
|
ListValue list_value = 6;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Represents a JSON `null`.
|
||
|
|
//
|
||
|
|
// `NullValue` is a sentinel, using an enum with only one value to represent
|
||
|
|
// the null value for the `Value` type union.
|
||
|
|
//
|
||
|
|
// A field of type `NullValue` with any value other than `0` is considered
|
||
|
|
// invalid. Most ProtoJSON serializers will emit a Value with a `null_value` set
|
||
|
|
// as a JSON `null` regardless of the integer value, and so will round trip to
|
||
|
|
// a `0` value.
|
||
|
|
enum NullValue {
|
||
|
|
// Null value.
|
||
|
|
NULL_VALUE = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Represents a JSON array.
|
||
|
|
message ListValue {
|
||
|
|
// Repeated field of dynamically typed values.
|
||
|
|
repeated Value values = 1;
|
||
|
|
}
|