config

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package config provides types and functions for reading and writing librarian.yaml configuration files.

Index

Constants

View Source
const (
	// BranchMain is the default git branch name.
	BranchMain = "main"

	// LibrarianYAML is the filename for the librarian configuration file.
	LibrarianYAML = "librarian.yaml"

	// RemoteUpstream is the default git remote name.
	RemoteUpstream = "upstream"
)
View Source
const (
	// LanguageUnknown represents an unsupported or unspecified language.
	LanguageUnknown = "unknown"
	// LanguageAll is the identifier for all languages.
	LanguageAll = "all"
	// LanguageCsharp is the language identifier for C#.
	LanguageCsharp = "csharp"
	// LanguageDart is the language identifier for Dart.
	LanguageDart = "dart"
	// LanguageDotnet is the language identifier for .NET.
	LanguageDotnet = "dotnet"
	// LanguageFake is the language identifier for Fakes.
	LanguageFake = "fake"
	// LanguageGo is the language identifier for Go.
	LanguageGo = "go"
	// LanguageJava is the language identifier for Java.
	LanguageJava = "java"
	// LanguageNodejs is the language identifier for Node.js.
	LanguageNodejs = "nodejs"
	// LanguagePhp is the language identifier for PHP.
	LanguagePhp = "php"
	// LanguagePython is the language identifier for Python.
	LanguagePython = "python"
	// LanguageRuby is the language identifier for Ruby.
	LanguageRuby = "ruby"
	// LanguageRust is the language identifier for Rust.
	LanguageRust = "rust"
	// LanguageRustStorage is a variation of the Rust generator for storage.
	LanguageRustStorage = "rust_storage"
	// LanguageSwift is the language identifier for Swift.
	LanguageSwift = "swift"
)
View Source
const (
	// SpecProtobuf defines the name for service specifications based on
	// [Protobuf].
	//
	// [Protobuf]: https://protocolbuffers.dev
	SpecProtobuf = "protobuf"
	// SpecDiscovery defines the name for service specifications based on
	// [Discovery docs].
	//
	// [Discovery docs]: https://developers.google.com/discovery/v1/reference/apis
	SpecDiscovery = "discovery"
	// SpecOpenAPI defines the name for service specifications based on
	// [OpenAPI].
	//
	// [OpenAPI]: https://swagger.io/specification/
	SpecOpenAPI = "openapi"
	// SpecNone is used for client library specifications that combine two other
	// clients. The only case today is Cloud Storage for Rust.
	SpecNone = "none"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.1.1

type API struct {
	// Path specifies which googleapis Path to generate from (for generated
	// libraries).
	Path string `yaml:"path,omitempty"`
}

API describes an API to include in a library.

type CargoTool added in v0.10.0

type CargoTool struct {
	// Name is the cargo package name.
	Name string `yaml:"name"`

	// Version is the version to install.
	Version string `yaml:"version"`
}

CargoTool defines a tool to install via cargo.

type Config

type Config struct {
	// Language is the language for this workspace (go, python, rust).
	Language string `yaml:"language"`

	// Version is the librarian tool version to use.
	Version string `yaml:"version,omitempty"`

	// Repo is the repository name, such as "googleapis/google-cloud-python".
	// It is used for:
	// - Providing to the Java GAPIC generator for observability features.
	// - Generating the .repo-metadata.json.
	Repo string `yaml:"repo,omitempty"`

	// Sources references external source repositories.
	Sources *Sources `yaml:"sources,omitempty"`

	// Tools defines required tools.
	Tools *Tools `yaml:"tools,omitempty"`

	// Release holds the configuration parameter for publishing and release subcommands.
	Release *Release `yaml:"release,omitempty"`

	// Default contains default settings for all libraries. They apply to all libraries unless overridden.
	Default *Default `yaml:"default,omitempty"`

	// Libraries contains configuration overrides for libraries that need
	// special handling, and differ from default settings.
	Libraries []*Library `yaml:"libraries,omitempty"`
}

Config represents a librarian.yaml configuration file.

type DartPackage added in v0.8.0

type DartPackage struct {
	// APIKeysEnvironmentVariables is a comma-separated list of environment variable names
	// that can contain API keys (e.g., "GOOGLE_API_KEY,GEMINI_API_KEY").
	APIKeysEnvironmentVariables string `yaml:"api_keys_environment_variables,omitempty"`

	// Dependencies is a comma-separated list of dependencies.
	Dependencies string `yaml:"dependencies,omitempty"`

	// DevDependencies is a comma-separated list of development dependencies.
	DevDependencies string `yaml:"dev_dependencies,omitempty"`

	// ExtraImports is additional imports to include in the generated library.
	ExtraImports string `yaml:"extra_imports,omitempty"`

	// IncludeList is a list of proto files to include (e.g., "date.proto", "expr.proto").
	IncludeList []string `yaml:"include_list,omitempty"`

	// IssueTrackerURL is the URL for the issue tracker.
	IssueTrackerURL string `yaml:"issue_tracker_url,omitempty"`

	// LibraryPathOverride overrides the library path.
	LibraryPathOverride string `yaml:"library_path_override,omitempty"`

	// NameOverride overrides the package name
	NameOverride string `yaml:"name_override,omitempty"`

	// Packages maps Dart package names to version constraints.
	// Keys are in the format "package:googleapis_auth" and values are version strings like "^2.0.0".
	// These are merged with default settings, with library settings taking precedence.
	Packages map[string]string `yaml:"packages,omitempty"`

	// PartFile is the path to a part file to include in the generated library.
	PartFile string `yaml:"part_file,omitempty"`

	// Prefixes maps protobuf package names to Dart import prefixes.
	// Keys are in the format "prefix:google.protobuf" and values are the prefix names.
	// These are merged with default settings, with library settings taking precedence.
	Prefixes map[string]string `yaml:"prefixes,omitempty"`

	// Protos maps protobuf package names to Dart import paths.
	// Keys are in the format "proto:google.api" and values are import paths like "package:google_cloud_api/api.dart".
	// These are merged with default settings, with library settings taking precedence.
	Protos map[string]string `yaml:"protos,omitempty"`

	// ReadmeAfterTitleText is text to insert in the README after the title.
	ReadmeAfterTitleText string `yaml:"readme_after_title_text,omitempty"`

	// ReadmeQuickstartText is text to use for the quickstart section in the README.
	ReadmeQuickstartText string `yaml:"readme_quickstart_text,omitempty"`

	// RepositoryURL is the URL to the repository for this package.
	RepositoryURL string `yaml:"repository_url,omitempty"`

	// TitleOverride overrides the API title.
	TitleOverride string `yaml:"title_override,omitempty"`

	// Version is the version of the dart package.
	Version string `yaml:"version,omitempty"`
}

DartPackage contains Dart-specific library configuration.

type Default added in v0.8.0

type Default struct {
	// Keep lists files and directories to preserve during regeneration.
	Keep []string `yaml:"keep,omitempty"`
	// Output is the directory where code is written. For example, for Rust
	// this is src/generated.
	Output string `yaml:"output,omitempty"`

	// TagFormat is the template for git tags, such as "{name}/v{version}".
	TagFormat string `yaml:"tag_format,omitempty"`

	// Dotnet contains .NET-specific default configuration.
	Dotnet *DotnetPackage `yaml:"dotnet,omitempty"`

	// Dart contains Dart-specific default configuration.
	Dart *DartPackage `yaml:"dart,omitempty"`

	// Java contains Java-specific default configuration.
	Java *JavaModule `yaml:"java,omitempty"`

	// Nodejs contains Node.js-specific default configuration.
	Nodejs *NodejsPackage `yaml:"nodejs,omitempty"`

	// Rust contains Rust-specific default configuration.
	Rust *RustDefault `yaml:"rust,omitempty"`

	// Python contains Python-specific default configuration.
	Python *PythonDefault `yaml:"python,omitempty"`
}

Default contains default settings for all libraries.

type DotnetCsproj added in v0.8.4

type DotnetCsproj struct {
	// Snippets contains XML fragments for .csproj files.
	Snippets *DotnetCsprojSnippets `yaml:"snippets,omitempty"`

	// IntegrationTests contains configuration for integration test projects.
	IntegrationTests *DotnetCsprojSnippets `yaml:"integration_tests,omitempty"`
}

DotnetCsproj contains configuration for .csproj file generation.

type DotnetCsprojSnippets added in v0.8.4

type DotnetCsprojSnippets struct {
	// EmbeddedResources is a list of glob patterns for embedded resources.
	EmbeddedResources []string `yaml:"embedded_resources,omitempty"`
}

DotnetCsprojSnippets contains XML fragments to be merged into .csproj files.

type DotnetPackage added in v0.8.4

type DotnetPackage struct {
	// AdditionalServiceDescriptors is a list of extra service descriptors to include.
	AdditionalServiceDescriptors []string `yaml:"additional_service_descriptors,omitempty"`

	// Csproj contains configuration for .csproj file generation and overrides.
	Csproj *DotnetCsproj `yaml:"csproj,omitempty"`

	// Dependencies maps NuGet package IDs to version strings.
	Dependencies map[string]string `yaml:"dependencies,omitempty"`

	// Generator overrides the default generator (e.g., "proto").
	Generator string `yaml:"generator,omitempty"`

	// PackageGroup lists packages that must be released together.
	PackageGroup []string `yaml:"package_group,omitempty"`

	// Postgeneration contains post-generation shell commands or extra protos.
	Postgeneration []*DotnetPostgeneration `yaml:"postgeneration,omitempty"`

	// Pregeneration contains declarative proto mutations.
	Pregeneration []*DotnetPregeneration `yaml:"pregeneration,omitempty"`
}

DotnetPackage contains .NET-specific library configuration.

type DotnetPostgeneration added in v0.8.4

type DotnetPostgeneration struct {
	// Run is a shell command to execute.
	Run string `yaml:"run,omitempty"`

	// ExtraProto is an extra proto file to compile.
	ExtraProto string `yaml:"extra_proto,omitempty"`
}

DotnetPostgeneration represents a post-generation action.

type DotnetPregeneration added in v0.8.4

type DotnetPregeneration struct {
	// RenameMessage renames a message.
	RenameMessage *DotnetRenameMessage `yaml:"rename_message,omitempty"`

	// RemoveField removes a field from a message.
	RemoveField *DotnetRemoveField `yaml:"remove_field,omitempty"`

	// RenameRPC renames an RPC.
	RenameRPC *DotnetRenameRPC `yaml:"rename_rpc,omitempty"`
}

DotnetPregeneration represents a declarative proto mutation.

type DotnetRemoveField added in v0.8.4

type DotnetRemoveField struct {
	Message string `yaml:"message"`
	Field   string `yaml:"field"`
}

DotnetRemoveField contains remove field configuration.

type DotnetRenameMessage added in v0.8.4

type DotnetRenameMessage struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

DotnetRenameMessage contains rename message configuration.

type DotnetRenameRPC added in v0.8.4

type DotnetRenameRPC struct {
	From     string `yaml:"from"`
	To       string `yaml:"to"`
	WireName string `yaml:"wire_name,omitempty"`
}

DotnetRenameRPC contains rename RPC configuration.

type GoAPI added in v0.8.0

type GoAPI struct {
	// ClientPackage is the package name of the generated client.
	ClientPackage string `yaml:"client_package,omitempty"`
	// DIREGAPIC indicates whether generation uses DIREGAPIC (Discovery REST GAPICs).
	// This is typically false. Used for the GCE (compute) client.
	DIREGAPIC bool `yaml:"diregapic,omitempty"`
	// EnabledGeneratorFeatures provides a mechanism for enabling generator features
	// at the API level.
	EnabledGeneratorFeatures []string `yaml:"enabled_generator_features,omitempty"`
	// ImportPath is the Go import path for the API.
	ImportPath string `yaml:"import_path,omitempty"`
	// NestedProtos is a list of nested proto files.
	NestedProtos []string `yaml:"nested_protos,omitempty"`
	// NoMetadata indicates whether to skip generating gapic_metadata.json.
	// This is typically false.
	NoMetadata bool `yaml:"no_metadata,omitempty"`
	// NoSnippets indicates whether to skip generating snippets.
	// This is typically false.
	NoSnippets bool `yaml:"no_snippets,omitempty"`
	// Path is the source path.
	Path string `yaml:"path,omitempty"`
	// ProtoOnly determines whether to generate a Proto-only client.
	// A proto-only client does not define a service in the proto files.
	ProtoOnly bool `yaml:"proto_only,omitempty"`
	// ProtoPackage is the proto package name.
	ProtoPackage string `yaml:"proto_package,omitempty"`
}

GoAPI represents configuration for a single API within a Go module.

type GoModule added in v0.8.0

type GoModule struct {
	// DeleteGenerationOutputPaths is a list of paths to delete before generation.
	DeleteGenerationOutputPaths []string `yaml:"delete_generation_output_paths,omitempty"`
	// GoAPIs is a list of Go-specific API configurations.
	GoAPIs []*GoAPI `yaml:"go_apis,omitempty"`
	// ModulePathVersion is the version of the Go module path.
	ModulePathVersion string `yaml:"module_path_version,omitempty"`
	// NestedModule is the name of a nested module directory.
	NestedModule string `yaml:"nested_module,omitempty"`
}

GoModule represents the Go-specific configuration for a library.

type JavaAPI added in v0.8.4

type JavaAPI struct {
	// AdditionalProtos is a list of additional proto files to include in generation.
	AdditionalProtos []string `yaml:"additional_protos,omitempty"`

	// NoSamples determines whether to generate samples for the API.
	NoSamples bool `yaml:"no_samples,omitempty"`

	// Path is the source path.
	Path string `yaml:"path,omitempty"`
}

JavaAPI represents configuration for a single API within a Java module.

type JavaModule added in v0.8.4

type JavaModule struct {
	// APIIDOverride is the ID of the API (e.g., "pubsub.googleapis.com"),
	// allows the "api_id" field in .repo-metadata.json to be overridden.
	// Defaults to "{library.api_shortname}.googleapis.com".
	APIIDOverride string `yaml:"api_id_override,omitempty"`

	// APIReference is the URL for the API reference documentation.
	APIReference string `yaml:"api_reference,omitempty"`

	// APIDescriptionOverride allows the "api_description" field in
	// .repo-metadata.json to be overridden.
	APIDescriptionOverride string `yaml:"api_description_override,omitempty"`

	// ClientDocumentationOverride allows the "client_documentation" field in
	// .repo-metadata.json to be overridden.
	ClientDocumentationOverride string `yaml:"client_documentation_override,omitempty"`

	// NonCloudAPI indicates whether the API is NOT a Google Cloud API.
	// Defaults to false.
	NonCloudAPI bool `yaml:"non_cloud_api,omitempty"`

	// CodeownerTeam is the GitHub team that owns the code.
	CodeownerTeam string `yaml:"codeowner_team,omitempty"`

	// DistributionNameOverride allows the "distribution_name" field in
	// .repo-metadata.json to be overridden.
	DistributionNameOverride string `yaml:"distribution_name_override,omitempty"`

	// ExcludedDependencies is a list of dependencies to exclude.
	ExcludedDependencies string `yaml:"excluded_dependencies,omitempty"`

	// ExcludedPoms is a list of POM files to exclude.
	ExcludedPoms string `yaml:"excluded_poms,omitempty"`

	// ExtraVersionedModules is a list of extra versioned modules.
	ExtraVersionedModules string `yaml:"extra_versioned_modules,omitempty"`

	// GroupID is the Maven group ID, defaults to "com.google.cloud".
	GroupID string `yaml:"group_id,omitempty"`

	// IssueTrackerOverride allows the "issue_tracker" field in .repo-metadata.json
	// to be overridden.
	IssueTrackerOverride string `yaml:"issue_tracker_override,omitempty"`

	// LibrariesBomVersion is the version of the libraries-bom to use for Java.
	LibrariesBomVersion string `yaml:"libraries_bom_version,omitempty"`

	// LibraryTypeOverride allows the "library_type" field in .repo-metadata.json
	// to be overridden.
	LibraryTypeOverride string `yaml:"library_type_override,omitempty"`

	// MinJavaVersion is the minimum Java version required.
	MinJavaVersion int `yaml:"min_java_version,omitempty"`

	// NamePrettyOverride allows the "name_pretty" field in .repo-metadata.json
	// to be overridden.
	NamePrettyOverride string `yaml:"name_pretty_override,omitempty"`

	// JavaAPIs is a list of Java-specific API configurations.
	JavaAPIs []*JavaAPI `yaml:"java_apis,omitempty"`

	// ProductDocumentationOverride allows the "product_documentation" field in
	// .repo-metadata.json to be overridden.
	ProductDocumentationOverride string `yaml:"product_documentation_override,omitempty"`

	// RecommendedPackage is the recommended package name.
	RecommendedPackage string `yaml:"recommended_package,omitempty"`

	// BillingNotRequired indicates whether the API does NOT require billing.
	// This is typically false.
	BillingNotRequired bool `yaml:"billing_not_required,omitempty"`

	// RestDocumentation is the URL for the REST documentation.
	RestDocumentation string `yaml:"rest_documentation,omitempty"`

	// RpcDocumentation is the URL for the RPC documentation.
	RpcDocumentation string `yaml:"rpc_documentation,omitempty"`
}

JavaModule contains Java-specific library configuration. TODO(https://github.com/googleapis/librarian/issues/4130): add fill defaults for fields with default.

type Library added in v0.8.0

type Library struct {

	// Name is the library name, such as "secretmanager" or "storage".
	Name string `yaml:"name,omitempty"`

	// Version is the library version.
	Version string `yaml:"version,omitempty"`

	// Preview signifies that this API has a preview variant, and it contains
	// overrides specific to the preview API variant. This is merged with the
	// containing [Library], preferring those [Library.Preview] values that are
	// set over their counterpart in the containing configuration.
	//
	// The most common overrides are [Library.Version] and [Library.APIs], with
	// the former containing a pre-release version based on the containing
	// version of the stable client, and the latter being a subset of APIs,
	// typically omitting alpha and beta paths.
	//
	// The [Library.Output] may be a different location and derived on a
	// per-language basis, but will not be serialized in the configuration.
	//
	// Important: The boolean fields [Library.SkipRelease] and
	// [Library.SkipGenerate] set in the containing config will always be
	// applied to the Preview library as well, because previews are related to
	// the stable library and should be managed identically.
	Preview *Library `yaml:"preview,omitempty"`

	// API specifies which googleapis API to generate from (for generated
	// libraries).
	APIs []*API `yaml:"apis,omitempty"`

	// CopyrightYear is the copyright year for the library.
	CopyrightYear string `yaml:"copyright_year,omitempty"`

	// DescriptionOverride overrides the library description.
	DescriptionOverride string `yaml:"description_override,omitempty"`

	// Keep lists files and directories to preserve during regeneration.
	Keep []string `yaml:"keep,omitempty"`

	// Output is the directory where code is written. This overrides
	// Default.Output.
	Output string `yaml:"output,omitempty"`

	// Roots specifies the source roots to use for generation. Defaults to googleapis.
	Roots []string `yaml:"roots,omitempty"`

	// SkipGenerate disables code generation for this library.
	SkipGenerate bool `yaml:"skip_generate,omitempty"`

	// SkipRelease disables release for this library.
	SkipRelease bool `yaml:"skip_release,omitempty"`

	// SpecificationFormat specifies the API specification format. Valid values
	// are "protobuf" (default) or "discovery".
	SpecificationFormat string `yaml:"specification_format,omitempty"`

	// Dotnet contains .NET-specific library configuration.
	Dotnet *DotnetPackage `yaml:"dotnet,omitempty"`

	// Dart contains Dart-specific library configuration.
	Dart *DartPackage `yaml:"dart,omitempty"`

	// Go contains Go-specific library configuration.
	Go *GoModule `yaml:"go,omitempty"`

	// Java contains Java-specific library configuration.
	Java *JavaModule `yaml:"java,omitempty"`

	// Nodejs contains Node.js-specific library configuration.
	Nodejs *NodejsPackage `yaml:"nodejs,omitempty"`

	// Python contains Python-specific library configuration.
	Python *PythonPackage `yaml:"python,omitempty"`

	// Rust contains Rust-specific library configuration.
	Rust *RustCrate `yaml:"rust,omitempty"`

	// Swift contains Swift-specific library configuration.
	Swift *SwiftPackage `yaml:"swift,omitempty"`
}

Library represents a library configuration.

type NPMTool added in v0.10.0

type NPMTool struct {
	// Name is the npm package name.
	Name string `yaml:"name"`

	// Version is the version to install.
	Version string `yaml:"version"`

	// Package is the URL or path of the package to install.
	Package string `yaml:"package,omitempty"`

	// Checksum is the SHA256 checksum of the package.
	Checksum string `yaml:"checksum,omitempty"`

	// Build defines the commands to run to build the tool after installation.
	Build []string `yaml:"build,omitempty"`
}

NPMTool defines a tool to install via npm.

type NodejsPackage added in v0.8.4

type NodejsPackage struct {
	// BundleConfig is the path to a GAPIC bundle config file.
	BundleConfig string `yaml:"bundle_config,omitempty"`

	// Dependencies maps npm package names to version constraints.
	Dependencies map[string]string `yaml:"dependencies,omitempty"`

	// ExtraProtocParameters is a list of extra parameters to pass to protoc.
	ExtraProtocParameters []string `yaml:"extra_protoc_parameters,omitempty"`

	// HandwrittenLayer indicates the library has a handwritten layer on top
	// of the generated code.
	HandwrittenLayer bool `yaml:"handwritten_layer,omitempty"`

	// MainService is the name of the main service for libraries with a
	// handwritten layer.
	MainService string `yaml:"main_service,omitempty"`

	// Mixins controls mixin behavior (e.g., "none" to disable).
	Mixins string `yaml:"mixins,omitempty"`

	// PackageName is the npm package name (e.g., "@google-cloud/access-approval").
	PackageName string `yaml:"package_name,omitempty"`
}

NodejsPackage contains Node.js-specific library configuration.

type PipTool added in v0.10.0

type PipTool struct {
	// Name is the pip package name.
	Name string `yaml:"name"`

	// Version is the version to install.
	Version string `yaml:"version"`

	// Package is the pip install specifier (e.g., "pkg@git+https://...").
	Package string `yaml:"package,omitempty"`
}

PipTool defines a tool to install via pip.

type PythonDefault added in v0.8.4

type PythonDefault struct {
	// CommonGAPICPaths contains paths which are generated for any package
	// containing a GAPIC API. These are relative to the package's output
	// directory, and the string "{neutral-source}" is replaced with the path
	// to the version-neutral source code (e.g. "google/cloud/run"). If a
	// library defines its own common_gapic_paths, they will be appended to
	// the defaults.
	CommonGAPICPaths []string `yaml:"common_gapic_paths,omitempty"`

	// LibraryType is the type to emit in .repo-metadata.json.
	LibraryType string `yaml:"library_type,omitempty"`
}

PythonDefault contains Python-specific default configuration.

type PythonPackage added in v0.8.0

type PythonPackage struct {
	PythonDefault `yaml:",inline"`

	// OptArgsByAPI contains additional options passed to the generator.
	// In each entry, the key is the API path and the value is the list of
	// options to pass when generating that API.
	// Example: {"google/cloud/secrets/v1beta": ["python-gapic-name=secretmanager"]}
	OptArgsByAPI map[string][]string `yaml:"opt_args_by_api,omitempty"`

	// ProtoOnlyAPIs contains the list of API paths which are proto-only, so
	// should use regular protoc Python generation instead of GAPIC.
	ProtoOnlyAPIs []string `yaml:"proto_only_apis,omitempty"`

	// NamePrettyOverride allows the "name_pretty" field in .repo-metadata.json
	// to be overridden, to reduce diffs while migrating.
	// TODO(https://github.com/googleapis/librarian/issues/4175): remove this
	// field.
	NamePrettyOverride string `yaml:"name_pretty_override,omitempty"`

	// ProductDocumentationOverride allows the "product_documentation" field in
	// .repo-metadata.json to be overridden, to reduce diffs while migrating.
	// TODO(https://github.com/googleapis/librarian/issues/4175): remove this
	// field.
	ProductDocumentationOverride string `yaml:"product_documentation_override,omitempty"`

	// APIShortnameOverride allows the "api_shortname" field in
	// .repo-metadata.json to be overridden, to reduce diffs while migrating.
	// TODO(https://github.com/googleapis/librarian/issues/4175): remove this
	// field.
	APIShortnameOverride string `yaml:"api_shortname_override,omitempty"`

	// APIIDOverride allows the "api_id" field in
	// .repo-metadata.json to be overridden, to reduce diffs while migrating.
	// TODO(https://github.com/googleapis/librarian/issues/4175): remove this
	// field.
	APIIDOverride string `yaml:"api_id_override,omitempty"`

	// ClientDocumentationOverride allows the client_documentation field in
	// .repo-metadata.json to be overridden from the default that's inferred.
	// TODO(https://github.com/googleapis/librarian/issues/4175): reduce uses
	// of this field to only cases where it's really needed.
	ClientDocumentationOverride string `yaml:"client_documentation_override,omitempty"`

	// IssueTrackerOverride allows the issue_tracker field in
	// .repo-metadata.json to be overridden, to reduce diffs while migrating.
	// TODO(https://github.com/googleapis/librarian/issues/4175): remove this
	// field.
	IssueTrackerOverride string `yaml:"issue_tracker_override,omitempty"`

	// MetadataNameOverride allows the name in .repo-metadata.json (which is
	// also used as part of the client documentation URI) to be overridden. By
	// default it's the package name, but older packages use the API short name
	// instead.
	MetadataNameOverride string `yaml:"metadata_name_override,omitempty"`

	// DefaultVersion is the default version of the API to use. When omitted,
	// the version in the first API path is used.
	DefaultVersion string `yaml:"default_version,omitempty"`

	// SkipReadmeCopy prevents generation from copying README.rst from the root
	// directory to the docs directory.
	// TODO(https://github.com/googleapis/librarian/issues/4738): revisit
	// whether or not this field should exist after migration.
	SkipReadmeCopy bool `yaml:"skip_readme_copy,omitempty"`
}

PythonPackage contains Python-specific library configuration. It inherits from PythonDefault, allowing library-specific overrides of global settings.

type Release added in v0.8.0

type Release struct {
	// IgnoredChanges defines globs that are ignored in change analysis.
	IgnoredChanges []string `yaml:"ignored_changes,omitempty"`

	// Preinstalled tools defines the list of tools that must be preinstalled.
	//
	// This is indexed by the well-known name of the tool vs. its path, e.g.
	// [preinstalled]
	// cargo = /usr/bin/cargo
	Preinstalled map[string]string `yaml:"preinstalled,omitempty"`

	// Tools defines the list of tools to install, indexed by installer.
	Tools map[string][]Tool `yaml:"tools,omitempty"`
}

Release holds the configuration parameter for publish command.

TODO(https://github.com/googleapis/librarian/issues/4910): delete Release.

type RustCrate added in v0.8.0

type RustCrate struct {
	RustDefault `yaml:",inline"`

	// Modules specifies generation targets for veneer crates. Each module
	// defines a source proto path, output location, and template to use.
	Modules []*RustModule `yaml:"modules,omitempty"`

	// PerServiceFeatures enables per-service feature flags.
	PerServiceFeatures bool `yaml:"per_service_features,omitempty"`

	// ModulePath is the module path for the crate.
	ModulePath string `yaml:"module_path,omitempty"`

	// TemplateOverride overrides the default template.
	TemplateOverride string `yaml:"template_override,omitempty"`

	// PackageNameOverride overrides the package name.
	PackageNameOverride string `yaml:"package_name_override,omitempty"`

	// RootName is the root name for the crate.
	RootName string `yaml:"root_name,omitempty"`

	// DefaultFeatures is a list of default features to enable.
	DefaultFeatures []string `yaml:"default_features,omitempty"`

	// IncludeList is a list of proto files to include (e.g., "date.proto", "expr.proto").
	IncludeList []string `yaml:"include_list,omitempty"`

	// IncludedIds is a list of IDs to include.
	IncludedIds []string `yaml:"included_ids,omitempty"`

	// SkippedIds is a list of IDs to skip.
	SkippedIds []string `yaml:"skipped_ids,omitempty"`

	// DisabledClippyWarnings is a list of clippy warnings to disable.
	DisabledClippyWarnings []string `yaml:"disabled_clippy_warnings,omitempty"`

	// HasVeneer indicates whether the crate has a veneer.
	HasVeneer bool `yaml:"has_veneer,omitempty"`

	// RoutingRequired indicates whether routing is required.
	RoutingRequired bool `yaml:"routing_required,omitempty"`

	// IncludeGrpcOnlyMethods indicates whether to include gRPC-only methods.
	IncludeGrpcOnlyMethods bool `yaml:"include_grpc_only_methods,omitempty"`

	// PostProcessProtos indicates whether to post-process protos.
	PostProcessProtos string `yaml:"post_process_protos,omitempty"`

	// DocumentationOverrides contains overrides for element documentation.
	DocumentationOverrides []RustDocumentationOverride `yaml:"documentation_overrides,omitempty"`

	// PaginationOverrides contains overrides for pagination configuration.
	PaginationOverrides []RustPaginationOverride `yaml:"pagination_overrides,omitempty"`

	// NameOverrides contains codec-level overrides for type and service names.
	NameOverrides string `yaml:"name_overrides,omitempty"`

	// Discovery contains discovery-specific configuration for LRO polling.
	Discovery *RustDiscovery `yaml:"discovery,omitempty"`

	// QuickstartServiceOverride overrides the default heuristically selected service for the package-level quickstart.
	QuickstartServiceOverride string `yaml:"quickstart_service_override,omitempty"`
}

RustCrate contains Rust-specific library configuration. It inherits from RustDefault, allowing library-specific overrides of global settings.

type RustDefault added in v0.8.0

type RustDefault struct {
	// PackageDependencies is a list of default package dependencies. These
	// are inherited by all libraries. If a library defines its own
	// package_dependencies, the library-specific ones take precedence over
	// these defaults for dependencies with the same name.
	PackageDependencies []*RustPackageDependency `yaml:"package_dependencies,omitempty"`

	// DisabledRustdocWarnings is a list of rustdoc warnings to disable.
	DisabledRustdocWarnings []string `yaml:"disabled_rustdoc_warnings,omitempty"`

	// GenerateSetterSamples indicates whether to generate setter samples.
	GenerateSetterSamples string `yaml:"generate_setter_samples,omitempty"`

	// GenerateRpcSamples indicates whether to generate RPC samples.
	GenerateRpcSamples string `yaml:"generate_rpc_samples,omitempty"`

	// DetailedTracingAttributes indicates whether to include detailed tracing attributes.
	DetailedTracingAttributes *bool `yaml:"detailed_tracing_attributes,omitempty"`

	// ResourceNameHeuristic indicates whether to apply heuristics to identify and generate resource names.
	ResourceNameHeuristic *bool `yaml:"resource_name_heuristic,omitempty"`
}

RustDefault contains Rust-specific default configuration.

type RustDiscovery added in v0.8.0

type RustDiscovery struct {
	// OperationID is the ID of the LRO operation type (e.g., ".google.cloud.compute.v1.Operation").
	OperationID string `yaml:"operation_id"`

	// Pollers is a list of LRO polling configurations.
	Pollers []RustPoller `yaml:"pollers,omitempty"`
}

RustDiscovery contains discovery-specific configuration for LRO polling.

type RustDocumentationOverride added in v0.8.0

type RustDocumentationOverride struct {
	// ID is the fully qualified element ID (e.g., .google.cloud.dialogflow.v2.Message.field).
	ID string `yaml:"id"`

	// Match is the text to match in the documentation.
	Match string `yaml:"match"`

	// Replace is the replacement text.
	Replace string `yaml:"replace"`
}

RustDocumentationOverride represents a documentation override for a specific element.

type RustModule added in v0.8.0

type RustModule struct {
	// DisabledRustdocWarnings specifies rustdoc lints to disable. An empty slice explicitly enables all warnings.
	DisabledRustdocWarnings yaml.StringSlice `yaml:"disabled_rustdoc_warnings,omitempty"`

	// DetailedTracingAttributes indicates whether to include detailed tracing attributes.
	// This overrides the crate-level setting.
	DetailedTracingAttributes *bool `yaml:"detailed_tracing_attributes,omitempty"`

	// DocumentationOverrides contains overrides for element documentation.
	DocumentationOverrides []RustDocumentationOverride `yaml:"documentation_overrides,omitempty"`

	// ExtendGrpcTransport indicates whether the transport stub can be
	// extended (in order to support streams).
	ExtendGrpcTransport bool `yaml:"extend_grpc_transport,omitempty"`

	// GenerateSetterSamples indicates whether to generate setter samples.
	GenerateSetterSamples string `yaml:"generate_setter_samples,omitempty"`

	// GenerateRpcSamples indicates whether to generate RPC samples.
	GenerateRpcSamples string `yaml:"generate_rpc_samples,omitempty"`

	// HasVeneer indicates whether this module has a handwritten wrapper.
	HasVeneer bool `yaml:"has_veneer,omitempty"`

	// IncludedIds is a list of proto IDs to include in generation.
	IncludedIds []string `yaml:"included_ids,omitempty"`

	// IncludeGrpcOnlyMethods indicates whether to include gRPC-only methods.
	IncludeGrpcOnlyMethods bool `yaml:"include_grpc_only_methods,omitempty"`

	// IncludeList is a list of proto files to include (e.g., "date.proto,expr.proto").
	IncludeList string `yaml:"include_list,omitempty"`

	// InternalBuilders indicates whether generated builders should be internal to the crate.
	InternalBuilders bool `yaml:"internal_builders,omitempty"`

	// Language can be used to select a variation of the Rust generator.
	// For example, `rust_storage` enables special handling for the storage client.
	Language string `yaml:"language,omitempty"`

	// ModulePath is the Rust module path for converters
	// (e.g., "crate::generated::gapic::model").
	ModulePath string `yaml:"module_path,omitempty"`

	ModuleRoots map[string]string `yaml:"module_roots,omitempty"`

	// NameOverrides contains codec-level overrides for type and service names.
	NameOverrides string `yaml:"name_overrides,omitempty"`

	// Output is the directory where generated code is written
	// (e.g., "src/storage/src/generated/gapic").
	Output string `yaml:"output"`

	// PostProcessProtos contains code to post-process generated protos.
	PostProcessProtos string `yaml:"post_process_protos,omitempty"`

	// ResourceNameHeuristic indicates whether to apply heuristics to identify and generate resource names.
	// This overrides the crate-level setting.
	ResourceNameHeuristic *bool `yaml:"resource_name_heuristic,omitempty"`

	// RootName is the key for the root directory in the source map.
	// It overrides the default root, googleapis, used by the rust+prost generator.
	RootName string `yaml:"root_name,omitempty"`

	// RoutingRequired indicates whether routing is required.
	RoutingRequired bool `yaml:"routing_required,omitempty"`

	// ServiceConfig is the path to the service config file.
	ServiceConfig string `yaml:"service_config,omitempty"`

	// SkippedIds is a list of proto IDs to skip in generation.
	SkippedIds []string `yaml:"skipped_ids,omitempty"`

	// SpecificationFormat overrides the library-level specification format.
	SpecificationFormat string `yaml:"specification_format,omitempty"`

	// APIPath is the proto path to generate from (e.g., "google/storage/v2").
	APIPath string `yaml:"api_path"`

	// Template specifies which generator template to use.
	// Valid values: "grpc-client", "http-client", "prost", "convert-prost", "mod".
	Template string `yaml:"template"`
}

RustModule defines a generation target within a veneer crate. Each module specifies what proto source to use, which template to apply, and where to output the generated code.

type RustPackageDependency added in v0.8.0

type RustPackageDependency struct {
	// Name is the dependency name. It is listed first so it appears at the top
	// of each dependency entry in YAML.
	Name string `yaml:"name"`

	// Ignore prevents this package from being mapped to an external crate.
	// When true, references to this package stay as `crate::` instead of being
	// mapped to the external crate name. This is used for self-referencing
	// packages like location and longrunning.
	Ignore bool `yaml:"ignore,omitempty"`

	// Package is the package name.
	Package string `yaml:"package"`

	// Source is the dependency source.
	Source string `yaml:"source,omitempty"`

	// Feature is the feature name for the dependency.
	Feature string `yaml:"feature,omitempty"`

	// ForceUsed forces the dependency to be used even if not referenced.
	ForceUsed bool `yaml:"force_used,omitempty"`

	// UsedIf specifies a condition for when the dependency is used.
	UsedIf string `yaml:"used_if,omitempty"`
}

RustPackageDependency represents a package dependency configuration.

type RustPaginationOverride added in v0.8.0

type RustPaginationOverride struct {
	// ID is the fully qualified method ID (e.g., .google.cloud.sql.v1.Service.Method).
	ID string `yaml:"id"`

	// ItemField is the name of the field used for items.
	ItemField string `yaml:"item_field"`
}

RustPaginationOverride represents a pagination override for a specific method.

type RustPoller added in v0.8.0

type RustPoller struct {
	// Prefix is an acceptable prefix for the URL path (e.g., "compute/v1/projects/{project}/zones/{zone}").
	Prefix string `yaml:"prefix"`

	// MethodID is the corresponding method ID (e.g., ".google.cloud.compute.v1.zoneOperations.get").
	MethodID string `yaml:"method_id"`
}

RustPoller defines how to find a suitable poller RPC for discovery APIs.

type Source added in v0.8.0

type Source struct {
	// Branch is the source's git branch to pull updates from.
	// Unset should be interpreted as the repository default branch.
	Branch string `yaml:"branch,omitempty"`

	// Commit is the git commit hash or tag to use.
	Commit string `yaml:"commit"`

	// Dir is a local directory path to use instead of fetching.
	// If set, Commit and SHA256 are ignored.
	Dir string `yaml:"dir,omitempty"`

	// SHA256 is the expected hash of the tarball for this commit.
	SHA256 string `yaml:"sha256,omitempty"`

	// Subpath is a directory inside the fetched archive that should be treated as
	// the root for operations.
	Subpath string `yaml:"subpath,omitempty"`
}

Source represents a source repository.

type Sources added in v0.8.0

type Sources struct {
	// Conformance is the path to the `conformance-tests` repository, used as include directory for `protoc`.
	Conformance *Source `yaml:"conformance,omitempty"`

	// Discovery is the discovery-artifact-manager repository configuration.
	Discovery *Source `yaml:"discovery,omitempty"`

	// Googleapis is the googleapis repository configuration.
	Googleapis *Source `yaml:"googleapis,omitempty"`

	// ProtobufSrc is the path to the `protobuf` repository, used as include directory for `protoc`.
	ProtobufSrc *Source `yaml:"protobuf,omitempty"`

	// Showcase is the showcase repository configuration.
	Showcase *Source `yaml:"showcase,omitempty"`
}

Sources references external source repositories.

type SwiftDefault added in v0.10.0

type SwiftDefault struct {
	// Dependencies is a list of package dependencies.
	Dependencies []SwiftDependency `yaml:"dependencies,omitempty"`
}

SwiftDefault contains the configuration shared by all Swift libraries.

type SwiftDependency added in v0.10.0

type SwiftDependency struct {
	// Name is an identifier for the package within the project.
	//
	// For example, `swift-protobuf`. This is usually the last component of the path or the URL.
	Name string `yaml:"name"`
	// Path configures the path for local (to the monorepo) packages.
	//
	// For example, the authentication package definition will set this to `packages/auth`, which
	// would generate the following snippet in the `Package.swift` files:
	//
	// “`
	// .package(path: "../../packages/auth")
	// “`
	Path string `yaml:"path,omitempty"`
	// URL configures the `url:` parameter in the package definition.
	//
	// For example, `https://github.com/apple/swift-protobuf` would generate the following snippet in
	// the `Package.swift` files:
	//
	// “`
	// .package(url: "https://github.com/apple/swift-protobuf")
	// “`
	URL string `yaml:"url,omitempty"`
	// Version configures the minimum version for exaternal package definitions.
	//
	// For example, if the `swift-protobuf` package used `1.36.1`, then the codec would generate the
	// following snippet in the `Package.swift` files:
	//
	// “`
	// .package(url: "https://github.com/apple/swift-protobuf", from: "1.36.1")
	// “`
	Version string `yaml:"version,omitempty"`
	// RequiredByServices is true if this dependency is required by packages with services.
	//
	// This will be set for the `gax` library and the `auth` library. Maybe more if we split the HTTP
	// and gRPC clients into separate libraries.
	RequiredByServices bool `yaml:"required_by_services,omitempty"`
	// ApiPackage is the name of the API package provided by this library.
	//
	// In Swift a package contains at most one channel for one API. For packages that implement an
	// API, this field contains the name of the package in the specification language of that API.
	// At the moment this is only used by Protobuf-based APIs, as OpenAPI and discovery doc APIs are
	// self-contained.
	//
	// Note that some packages, for example `auth` and `gax`, do not implement APIs. This field is
	// empty for such libraries.
	//
	// Examples:
	// - The `GoogleCloudWkt` package will set this to `google.cloud.protobuf`.
	// - The `GoogleCloudLocation` package will set this to `google.cloud.location`.
	ApiPackage string `yaml:"api_package,omitempty"`
}

SwiftDependency represents a dependency in Swift Package Manager.

type SwiftPackage added in v0.10.0

type SwiftPackage struct {
	SwiftDefault `yaml:",inline"`
}

SwiftPackage contains Swift-specific configuration for a Swift library.

It inherits from SwiftDefault, allowing library-specific overrides of global settings.

type Tool added in v0.8.0

type Tool struct {
	// Name is the name of the tool e.g. nox.
	Name string `yaml:"name"`

	// Version is the version of the tool e.g. 1.2.4.
	Version string `yaml:"version,omitempty"`
}

Tool defines the configuration required to install helper tools.

type Tools added in v0.10.0

type Tools struct {
	// Cargo defines tools to install via cargo.
	Cargo []*CargoTool `yaml:"cargo,omitempty"`

	// NPM defines tools to install via npm.
	NPM []*NPMTool `yaml:"npm,omitempty"`

	// Pip defines tools to install via pip.
	Pip []*PipTool `yaml:"pip,omitempty"`
}

Tools defines required tools.

Directories

Path Synopsis
Package gapicyaml provides parsing for GAPIC YAML configuration files.
Package gapicyaml provides parsing for GAPIC YAML configuration files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL