Skip to content

Commit a39d51a

Browse files
authored
feat(tool/cmd/importconfigs): add update-release-level subcommand (#4520)
A new update-release-level subcommand is added to the importconfigs tool to parse the release_level attribute from `BUILD.bazel` files in the googleapis directory. The API struct in `internal/serviceconfig` is updated to include a `ReleaseLevels` map. This map is populated by the new command to track the release level per language for each API, which allows the generator to determine the appropriate release level dynamically instead of relying on default values. The result shows only Go has `release_level` in {lang}_gapic_library target. To reduce the configuration size, only add the value to API if it is `alpha` or `beta`. `internal/servceconfig/sdk.yaml` is updated with: ```sh go run tool/cmd/importconfigs update-release-level --googleapis=path/to/googleapis ``` For #4435
1 parent 6fb6bf9 commit a39d51a

12 files changed

Lines changed: 1123 additions & 6 deletions

File tree

doc/api-allowlist-schema.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This document describes the schema for the API Allowlist.
1414
| `no_rest_numeric_enums` | map[string]bool | Determines whether to use numeric enums in REST requests. The "No" prefix is used because the default behavior (when this field is `false` or omitted) is to generate numeric enums. Map key is the language name (e.g., "python", "rust"). Optional. If omitted, the generator default is used. |
1515
| `open_api` | string | Is the file path to an OpenAPI spec, currently in internal/testdata. This is not an official spec yet and exists only for Rust to validate OpenAPI support. |
1616
| `path` | string | Is the proto directory path in github.com/googleapis/googleapis. If ServiceConfig is empty, the service config is assumed to live at this path. |
17+
| `release_level` | map[string]string | Is the release level per language. Map key is the language name (e.g., "python", "rust"). Optional. If omitted, the generator default is used. |
1718
| `short_name` | string | Overrides the API short name from the service config's publishing section. |
1819
| `service_config` | string | Is the service config file path override. If empty, the service config is discovered in the directory specified by Path. |
1920
| `service_name` | string | Is a DNS-like logical identifier for the service, such as `calendar.googleapis.com`. |

internal/serviceconfig/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ type API struct {
8080
// If ServiceConfig is empty, the service config is assumed to live at this path.
8181
Path string `yaml:"path,omitempty"`
8282

83+
// ReleaseLevels is the release level per language.
84+
// Map key is the language name (e.g., "python", "rust").
85+
// Optional. If omitted, the generator default is used.
86+
ReleaseLevels map[string]string `yaml:"release_level,omitempty"`
87+
8388
// ShortName overrides the API short name from the service config's
8489
// publishing section.
8590
ShortName string `yaml:"short_name,omitempty"`

0 commit comments

Comments
 (0)