Skip to content

Commit 2bf976d

Browse files
author
Jon Skeet
authored
chore(serviceconfig): make Path the first field in API (#4702)
This just moves the Path field in the API type to the top, expanding the comment to explain that it's effectively the key within the list of APIs. The existing sdk.yaml file is then regenerated. Also adds python to the allow-list for google/maps/navconnect/v1. When modifying sdk.yaml, it's been all to easy to find a path which is within the middle of the relevant section, and then change the wrong field. While it's useful for most fields to be in alphabetical order, it makes sense to have this at the top, just as Name is at the top of the Library type. Fixes #4499
1 parent 8125cc9 commit 2bf976d

3 files changed

Lines changed: 965 additions & 959 deletions

File tree

doc/api-allowlist-schema.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ This document describes the schema for the API Allowlist.
66

77
| Field | Type | Description |
88
| :--- | :--- | :--- |
9+
| `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. |
910
| `description` | string | Provides the information for describing an API. |
1011
| `discovery` | string | Is the file path to a discovery document in github.com/googleapis/discovery-artifact-manager. Used by sidekick languages (Rust, Dart) as an alternative to proto files. |
1112
| `documentation_uri` | string | Overrides the product documentation URI from the service config's publishing section. |
1213
| `languages` | list of string | Restricts which languages can generate client libraries for this API. Empty means all languages can use this API. We should be explicit about supported languages when adding entries.<br><br>Restrictions exist for several reasons:<br>- Newer languages (Rust, Dart) skip older beta versions when stable versions exist<br>- Python has historical legacy APIs not available to other languages<br>- Some APIs (like DIREGAPIC protos) are only used by specific languages |
1314
| `new_issue_uri` | string | Overrides the new issue URI from the service config's publishing section. |
1415
| `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. |
1516
| `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. |
16-
| `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. |
1717
| `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. |
1818
| `short_name` | string | Overrides the API short name from the service config's publishing section. |
1919
| `service_config` | string | Is the service config file path override. If empty, the service config is discovered in the directory specified by Path. |

internal/serviceconfig/api.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ const (
3939

4040
// API describes an API path and its availability across languages.
4141
type API struct {
42+
// Note: Properties should typically be added in alphabetical order, but
43+
// because this order impacts YAML serialization, we keep Path at the top
44+
// for ease of consumption in file-form.
45+
46+
// Path is the proto directory path in github.com/googleapis/googleapis.
47+
// If ServiceConfig is empty, the service config is assumed to live at this
48+
// path.
49+
Path string `yaml:"path,omitempty"`
50+
4251
// Description provides the information for describing an API.
4352
Description string `yaml:"description,omitempty"`
4453

@@ -76,10 +85,6 @@ type API struct {
7685
// This is not an official spec yet and exists only for Rust to validate OpenAPI support.
7786
OpenAPI string `yaml:"open_api,omitempty"`
7887

79-
// Path is the proto directory path in github.com/googleapis/googleapis.
80-
// If ServiceConfig is empty, the service config is assumed to live at this path.
81-
Path string `yaml:"path,omitempty"`
82-
8388
// ReleaseLevels is the release level per language.
8489
// Map key is the language name (e.g., "python", "rust").
8590
// Optional. If omitted, the generator default is used.

0 commit comments

Comments
 (0)