convert

package
v0.10.1 Latest Latest
Warning

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

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

Documentation

Overview

Package convert moves the openapiv2 options of grpc-gateway (protoc-gen-openapiv2) in proto files to what the platform's OpenAPI generator reads: descriptions into proto comments, examples, tags and hidden methods into platform.openapi.v1 options, the file-level openapiv2_swagger into api/openapi/base.yaml. It runs once on a project that moves to the platform; whatever it cannot move stays as it was and is reported for a person.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	Path    string // relative to Dir
	Line    int
	Manual  bool // a person must look: the converter left something as it was
	Message string
}

Note is a line of the report.

func (Note) String

func (n Note) String() string

type Options

type Options struct {
	Dir      string // the project
	ProtoDir string // the proto folder, relative to Dir: imports are relative to it
	Base     string // api/openapi/base.yaml, relative to Dir
	DryRun   bool   // report only, write nothing
}

Options say where the proto files are and where the base goes.

type Report

type Report struct {
	Changed []string       // proto files rewritten, relative to Dir
	Base    string         // the file the openapiv2_swagger options went to, empty without any
	Counts  map[string]int // what was moved, by kind
	Notes   []Note
}

Report is what the conversion did.

func Run

func Run(o Options) (*Report, error)

Run converts the proto files of a project.

Jump to

Keyboard shortcuts

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