blob: 3dfdf85304b1f657eb6a8b95d0c40a9f5575bc31 [file] [edit]
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
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;
}