|
| 1 | +// Protocol Buffers - Google's data interchange format |
| 2 | +// Copyright 2023 Google Inc. All rights reserved. |
| 3 | +// |
| 4 | +// Use of this source code is governed by a BSD-style |
| 5 | +// license that can be found in the LICENSE file or at |
| 6 | +// https://developers.google.com/open-source/licenses/bsd |
| 7 | + |
| 8 | +syntax = "proto2"; |
| 9 | + |
| 10 | +package pb; |
| 11 | + |
| 12 | +import "google/protobuf/descriptor.proto"; |
| 13 | + |
| 14 | +option go_package = "google.golang.org/protobuf/types/gofeaturespb"; |
| 15 | + |
| 16 | +extend google.protobuf.FeatureSet { |
| 17 | + optional GoFeatures go = 1002; |
| 18 | +} |
| 19 | + |
| 20 | +message GoFeatures { |
| 21 | + // Whether or not to generate the deprecated UnmarshalJSON method for enums. |
| 22 | + optional bool legacy_unmarshal_json_enum = 1 [ |
| 23 | + retention = RETENTION_RUNTIME, |
| 24 | + targets = TARGET_TYPE_ENUM, |
| 25 | + targets = TARGET_TYPE_FILE, |
| 26 | + feature_support = { |
| 27 | + edition_introduced: EDITION_2023, |
| 28 | + edition_deprecated: EDITION_2023, |
| 29 | + deprecation_warning: "The legacy UnmarshalJSON API is deprecated and " |
| 30 | + "will be removed in a future edition.", |
| 31 | + }, |
| 32 | + edition_defaults = { edition: EDITION_LEGACY, value: "true" }, |
| 33 | + edition_defaults = { edition: EDITION_PROTO3, value: "false" } |
| 34 | + ]; |
| 35 | + |
| 36 | + enum APILevel { |
| 37 | + // API_LEVEL_UNSPECIFIED results in selecting the OPEN API, |
| 38 | + // but needs to be a separate value to distinguish between |
| 39 | + // an explicitly set api level or a missing api level. |
| 40 | + API_LEVEL_UNSPECIFIED = 0; |
| 41 | + API_OPEN = 1; |
| 42 | + API_HYBRID = 2; |
| 43 | + API_OPAQUE = 3; |
| 44 | + } |
| 45 | + |
| 46 | + // One of OPEN, HYBRID or OPAQUE. |
| 47 | + optional APILevel api_level = 2 [ |
| 48 | + retention = RETENTION_RUNTIME, |
| 49 | + targets = TARGET_TYPE_MESSAGE, |
| 50 | + targets = TARGET_TYPE_FILE, |
| 51 | + feature_support = { |
| 52 | + edition_introduced: EDITION_2023, |
| 53 | + }, |
| 54 | + edition_defaults = { edition: EDITION_LEGACY, value: "API_LEVEL_UNSPECIFIED" }, |
| 55 | + edition_defaults = { edition: EDITION_2024, value: "API_OPAQUE" } |
| 56 | + ]; |
| 57 | +} |
0 commit comments