// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package jsonpb provides functionality to marshal and unmarshal between a // protocol buffer message and JSON. It follows the specification at // https://developers.google.com/protocol-buffers/docs/proto3#json. // // Do not rely on the default behavior of the standard encoding/json package // when called on generated message types as it does not operate correctly. // // Deprecated: Use the "google.golang.org/protobuf/encoding/protojson" // package instead.
package jsonpb import ( ) // AnyResolver takes a type URL, present in an Any message, // and resolves it into an instance of the associated message. type AnyResolver interface { Resolve(typeURL string) (proto.Message, error) } type anyResolver struct{ AnyResolver } func ( anyResolver) ( protoreflect.FullName) (protoreflect.MessageType, error) { return .FindMessageByURL(string()) } func ( anyResolver) ( string) (protoreflect.MessageType, error) { , := .Resolve() if != nil { return nil, } return protoimpl.X.MessageTypeOf(), nil } func ( anyResolver) ( protoreflect.FullName) (protoreflect.ExtensionType, error) { return protoregistry.GlobalTypes.FindExtensionByName() } func ( anyResolver) ( protoreflect.FullName, protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { return protoregistry.GlobalTypes.FindExtensionByNumber(, ) } func ( protoreflect.FullName) string { if .Parent() == "google.protobuf" { switch .Name() { case "Empty", "Any", "BoolValue", "BytesValue", "StringValue", "Int32Value", "UInt32Value", "FloatValue", "Int64Value", "UInt64Value", "DoubleValue", "Duration", "Timestamp", "NullValue", "Struct", "Value", "ListValue": return string(.Name()) } } return "" } func ( protoreflect.MessageDescriptor) bool { , := .(interface{ () bool }) return && .() }