Help us shape the future of Go! Take the 2026 Go Developer Survey

parser

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package parser reads specifications and converts them into the `genclient.API` model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateModel

func CreateModel(cfg *ModelConfig) (*api.API, error)

CreateModel parses the service specification referenced in `config`, cross-references the model, and applies any transformations or overrides required by the configuration.

func ParseDisco

func ParseDisco(cfg *ModelConfig) (*api.API, error)

ParseDisco reads discovery docs specifications and converts them into the `api.API` model.

func ParseOpenAPI

func ParseOpenAPI(cfg *ModelConfig) (*api.API, error)

ParseOpenAPI parses an OpenAPI specification and returns an API model.

func ParseProtobuf

func ParseProtobuf(cfg *ModelConfig) (*api.API, error)

ParseProtobuf reads Protobuf specifications and converts them into the `api.API` model.

Types

type ModelConfig added in v0.8.1

type ModelConfig struct {
	Language string

	// Source configuration
	// SpecificationFormat is the format of the API specification.
	// Supported values are:
	// - `config.SpecDiscovery`: "discovery"
	// - `config.SpecOpenAPI`: "openapi"
	// - `config.SpecProtobuf`: "protobuf"
	// - `config.SpecNone`: "none"
	SpecificationFormat string
	SpecificationSource string
	Source              *sources.SourceConfig

	// Protoc configuration
	//
	// This is initialized in the tools configuration for `librarian.yaml`, we want to avoid passing the full
	// librarian configuration to the parsers.
	Protoc *config.Protoc

	// File paths to descriptor files
	DescriptorFilesToGenerate string
	DescriptorFiles           string

	// Service config
	ServiceConfig string

	// Codec configuration
	Codec map[string]string

	// Documentation/pagination overrides
	CommentOverrides    []api.DocumentationOverride
	PaginationOverrides []api.PaginationOverride

	// Discovery poller configurations
	Discovery *api.Discovery

	// Resource heuristic enablement
	ResourceNameHeuristic bool

	// Message module name overrides
	MessageModuleNameOverrides map[string]string

	// Model overrides
	Override api.ModelOverride
}

ModelConfig holds the configuration necessary to parse an API specification.

Directories

Path Synopsis
Package discovery parses Google Discovery Documents into the sidekick abstract API model (`api.API`).
Package discovery parses Google Discovery Documents into the sidekick abstract API model (`api.API`).
Package httprule provides a parser for the path templates found in [google.api.http] annotations.
Package httprule provides a parser for the path templates found in [google.api.http] annotations.
Package svcconfig contains helper functions to parse service config files.
Package svcconfig contains helper functions to parse service config files.

Jump to

Keyboard shortcuts

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