package gnostic_plugin_v1

import "github.com/google/gnostic/plugins"

Package gnostic_plugin_v1 is a generated protocol buffer package.

It is generated from these files:

plugin.proto

It has these top-level messages:

Version
Parameter
Request
Response
File

Index

Functions

func HandleResponse

func HandleResponse(response *Response, outputLocation string) error

Types

type Environment

type Environment struct {
	Request         *Request  // plugin request object
	Response        *Response // response message
	Invocation      string    // string representation of call
	RunningAsPlugin bool      // true if app is being run as a plugin
}

Environment contains the environment of a plugin call.

func NewEnvironment

func NewEnvironment() (env *Environment, err error)

NewEnvironment creates a plugin context from arguments and standard input.

func (*Environment) RespondAndExit

func (env *Environment) RespondAndExit()

RespondAndExit serializes and returns the plugin response and then exits.

func (*Environment) RespondAndExitIfError

func (env *Environment) RespondAndExitIfError(err error)

RespondAndExitIfError checks an error and if it is non-nil, records it and serializes and returns the response and then exits.

type File

type File struct {
	// name of the file
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	// data to be written to the file
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

File describes a file generated by a plugin.

func (*File) Descriptor

func (*File) Descriptor() ([]byte, []int)

func (*File) GetData

func (m *File) GetData() []byte

func (*File) GetName

func (m *File) GetName() string

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) Reset

func (m *File) Reset()

func (*File) String

func (m *File) String() string

type Parameter

type Parameter struct {
	// The name of the parameter as specified in the option string
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	// The parameter value as specified in the option string
	Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

A parameter passed to the plugin from (or through) gnostic.

func (*Parameter) Descriptor

func (*Parameter) Descriptor() ([]byte, []int)

func (*Parameter) GetName

func (m *Parameter) GetName() string

func (*Parameter) GetValue

func (m *Parameter) GetValue() string

func (*Parameter) ProtoMessage

func (*Parameter) ProtoMessage()

func (*Parameter) Reset

func (m *Parameter) Reset()

func (*Parameter) String

func (m *Parameter) String() string

type Request

type Request struct {
	// filename or URL of the original source document
	SourceName string `protobuf:"bytes,1,opt,name=source_name,json=sourceName" json:"source_name,omitempty"`
	// Output path specified in the plugin invocation.
	OutputPath string `protobuf:"bytes,2,opt,name=output_path,json=outputPath" json:"output_path,omitempty"`
	// Plugin parameters parsed from the invocation string.
	Parameters []*Parameter `protobuf:"bytes,3,rep,name=parameters" json:"parameters,omitempty"`
	// The version number of gnostic.
	CompilerVersion *Version `protobuf:"bytes,4,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
	// OpenAPI v2 API representation
	Openapi2 *openapi_v2.Document `protobuf:"bytes,5,opt,name=openapi2" json:"openapi2,omitempty"`
	// OpenAPI v3 API representation
	Openapi3 *openapi_v3.Document `protobuf:"bytes,6,opt,name=openapi3" json:"openapi3,omitempty"`
	// Discovery API representation
	Discovery *discovery_v1.Document `protobuf:"bytes,7,opt,name=discovery" json:"discovery,omitempty"`
	// generated code surface representation
	Surface *surface_v1.Model `protobuf:"bytes,8,opt,name=surface" json:"surface,omitempty"`
}

An encoded Request is written to the plugin's stdin.

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetCompilerVersion

func (m *Request) GetCompilerVersion() *Version

func (*Request) GetDiscovery

func (m *Request) GetDiscovery() *discovery_v1.Document

func (*Request) GetOpenapi2

func (m *Request) GetOpenapi2() *openapi_v2.Document

func (*Request) GetOpenapi3

func (m *Request) GetOpenapi3() *openapi_v3.Document

func (*Request) GetOutputPath

func (m *Request) GetOutputPath() string

func (*Request) GetParameters

func (m *Request) GetParameters() []*Parameter

func (*Request) GetSourceName

func (m *Request) GetSourceName() string

func (*Request) GetSurface

func (m *Request) GetSurface() *surface_v1.Model

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

type Response

type Response struct {
	// Error message.  If non-empty, the plugin failed.
	// The plugin process should exit with status code zero
	// even if it reports an error in this way.
	//
	// This should be used to indicate errors which prevent the plugin from
	// operating as intended.  Errors which indicate a problem in openapic
	// itself -- such as the input Document being unparseable -- should be
	// reported by writing a message to stderr and exiting with a non-zero
	// status code.
	Errors []string `protobuf:"bytes,1,rep,name=errors" json:"errors,omitempty"`
	// file output, each file will be written by openapic to an appropriate location.
	Files []*File `protobuf:"bytes,2,rep,name=files" json:"files,omitempty"`
}

The plugin writes an encoded Response to stdout.

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetErrors

func (m *Response) GetErrors() []string

func (*Response) GetFiles

func (m *Response) GetFiles() []*File

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

type Version

type Version struct {
	Major int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
	Minor int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"`
	Patch int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"`
	// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
	// be empty for mainline stable releases.
	Suffix string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"`
}

The version number of gnostic.

func (*Version) Descriptor

func (*Version) Descriptor() ([]byte, []int)

func (*Version) GetMajor

func (m *Version) GetMajor() int32

func (*Version) GetMinor

func (m *Version) GetMinor() int32

func (*Version) GetPatch

func (m *Version) GetPatch() int32

func (*Version) GetSuffix

func (m *Version) GetSuffix() string

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) Reset

func (m *Version) Reset()

func (*Version) String

func (m *Version) String() string

Source Files

environment.go plugin.pb.go

Directories

PathSynopsis
plugins/gnostic-analyzegnostic_analyze is a tool for analyzing OpenAPI descriptions.
plugins/gnostic-analyze/statistics
plugins/gnostic-analyze/summarizesummarize is a tool for summarizing the results of gnostic_analyze runs.
plugins/gnostic-go-generatorgnostic_go_generator is a sample Gnostic plugin that generates Go code that supports an API.
plugins/gnostic-go-generator/examples
plugins/gnostic-go-generator/examples/googleauth
plugins/gnostic-go-generator/examples/v2.0
plugins/gnostic-go-generator/examples/v2.0/apis_guru
plugins/gnostic-go-generator/examples/v2.0/bookstore
plugins/gnostic-go-generator/examples/v2.0/bookstore/service
plugins/gnostic-go-generator/examples/v2.0/xkcd
plugins/gnostic-go-generator/examples/v3.0
plugins/gnostic-go-generator/examples/v3.0/bookstore
plugins/gnostic-go-generator/examples/v3.0/bookstore/service
plugins/gnostic-go-generator/examples/v3.0/urlshortener
plugins/gnostic-summarygnostic_go_generator is a sample Gnostic plugin that generates Go code that supports an API.
Version
v0.1.0
Published
Sep 5, 2017
Platform
windows/amd64
Imports
13 packages
Last checked
9 minutes ago

Tools for package owners.