repometadata

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package repometadata represents the data in .repo-metadata.json files, and the ability to create those files from other Librarian configuration.

Index

Constants

View Source
const (

	// GAPICAutoLibraryType is the library_type to use for GAPIC libraries.
	GAPICAutoLibraryType = "GAPIC_AUTO"
)

Variables

View Source
var (
	// ErrNoAPIs indicates that a library has no APIs configured.
	ErrNoAPIs = errors.New("library has no APIs from which to get metadata")
)

Functions

func WriteJSON added in v0.8.4

func WriteJSON(data any, indent, libraryOutputDir, filename string) error

WriteJSON marshals the given data to JSON with indentation and writes it to the specified file in the output directory.

Types

type RepoMetadata

type RepoMetadata struct {
	// APIDescription is the description of the API.
	APIDescription string `json:"api_description,omitempty"`

	// APIID is the fully qualified API ID (e.g., "secretmanager.googleapis.com").
	APIID string `json:"api_id,omitempty"`

	// APIShortname is the short name of the API.
	APIShortname string `json:"api_shortname,omitempty"`

	// ClientDocumentation is the URL to the client library documentation.
	ClientDocumentation string `json:"client_documentation,omitempty"`

	// ClientLibraryType is the type of the client library (e.g. "generated").
	// A Go specific field.
	ClientLibraryType string `json:"client_library_type,omitempty"`

	// DefaultVersion is the default API version (e.g., "v1", "v1beta1").
	DefaultVersion string `json:"default_version,omitempty"`

	// Description is a short description of the API.
	// A Go specific field.
	Description string `json:"description,omitempty"`

	// DistributionName is the name of the library distribution package.
	DistributionName string `json:"distribution_name,omitempty"`

	// IssueTracker is the URL to the issue tracker.
	IssueTracker string `json:"issue_tracker,omitempty"`

	// Language is the programming language (e.g., "rust", "python", "go").
	Language string `json:"language,omitempty"`

	// LibraryType is the type of library (e.g., "GAPIC_AUTO").
	LibraryType string `json:"library_type,omitempty"`

	// Name is the API short name.
	Name string `json:"name,omitempty"`

	// NamePretty is the human-readable name of the API.
	NamePretty string `json:"name_pretty,omitempty"`

	// ProductDocumentation is the URL to the product documentation.
	ProductDocumentation string `json:"product_documentation,omitempty"`

	// ReleaseLevel is the release level (e.g., "stable", "preview").
	ReleaseLevel string `json:"release_level,omitempty"`

	// Repo is the repository name (e.g., "googleapis/google-cloud-rust").
	Repo string `json:"repo,omitempty"`

	// Transport is the transport protocol used by the library (e.g. "grpc", "rest").
	Transport string `json:"transport,omitempty"`

	// RecommendedPackage is the recommended package name.
	// A Java-specific field.
	RecommendedPackage string `json:"recommended_package,omitempty"`
}

RepoMetadata represents the .repo-metadata.json file structure.

func FromLibrary added in v0.8.2

func FromLibrary(cfg *config.Config, library *config.Library, googleapisDir string) (*RepoMetadata, error)

FromLibrary creates a RepoMetadata from a specific library in a configuration. It retrieves API information from the provided googleapisDir and constructs common metadata. This function populates the following fields: - APIDescription - APIID - APIShortName - DistributionName - IssueTracker - Language - Name - NamePretty - ProductDocumentation - ReleaseLevel - Repo - Transport (Java only)

Any other fields required by the caller's language should be populated by the caller before writing to disk.

func Read added in v0.8.4

func Read(libraryOutputDir string) (*RepoMetadata, error)

Read reads the .repo-metadata.json file in the given directory and unmarshals it as a RepoMetadata.

func (*RepoMetadata) Write added in v0.8.4

func (metadata *RepoMetadata) Write(libraryOutputDir string) error

Write writes the given RepoMetadata into libraryOutputDir/.repo-metadata.json.

Jump to

Keyboard shortcuts

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