gnostic_extension_v1

package
v0.0.0-...-5117bfe Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

Extensions

Extension Support is experimental.

This directory contains support code for building Gnostic extensio handlers and associated examples.

Extension handlers can be used to compile vendor or specification extensions into protocol buffer structures.

Like plugins, extension handlers are built as separate executables. Extension bodies are written to extension handlers as serialized ExtensionHandlerRequests.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_extensions_extension_proto protoreflect.FileDescriptor

Functions

func Main

func Main(handler extensionHandler)

Main implements the main program of an extension handler.

Types

type ExtensionHandlerRequest

type ExtensionHandlerRequest struct {

	// The extension to process.
	Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"`
	// The version number of Gnostic.
	CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"`
	// contains filtered or unexported fields
}

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

func (*ExtensionHandlerRequest) Descriptor deprecated

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

Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead.

func (*ExtensionHandlerRequest) GetCompilerVersion

func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version

func (*ExtensionHandlerRequest) GetWrapper

func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper

func (*ExtensionHandlerRequest) ProtoMessage

func (*ExtensionHandlerRequest) ProtoMessage()

func (*ExtensionHandlerRequest) ProtoReflect

func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message

func (*ExtensionHandlerRequest) Reset

func (x *ExtensionHandlerRequest) Reset()

func (*ExtensionHandlerRequest) String

func (x *ExtensionHandlerRequest) String() string

type ExtensionHandlerResponse

type ExtensionHandlerResponse struct {

	// true if the extension is handled by the extension handler; false otherwise
	Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"`
	// Error message(s).  If non-empty, the extension handling failed.
	// The extension handler 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 extension from
	// operating as intended.  Errors which indicate a problem in gnostic
	// 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,2,rep,name=errors,proto3" json:"errors,omitempty"`
	// text output
	Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

The extensions writes an encoded ExtensionHandlerResponse to stdout.

func (*ExtensionHandlerResponse) Descriptor deprecated

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

Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead.

func (*ExtensionHandlerResponse) GetErrors

func (x *ExtensionHandlerResponse) GetErrors() []string

func (*ExtensionHandlerResponse) GetHandled

func (x *ExtensionHandlerResponse) GetHandled() bool

func (*ExtensionHandlerResponse) GetValue

func (x *ExtensionHandlerResponse) GetValue() *anypb.Any

func (*ExtensionHandlerResponse) ProtoMessage

func (*ExtensionHandlerResponse) ProtoMessage()

func (*ExtensionHandlerResponse) ProtoReflect

func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message

func (*ExtensionHandlerResponse) Reset

func (x *ExtensionHandlerResponse) Reset()

func (*ExtensionHandlerResponse) String

func (x *ExtensionHandlerResponse) String() string

type Version

type Version struct {
	Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
	Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
	Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" 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,proto3" json:"suffix,omitempty"`
	// contains filtered or unexported fields
}

The version number of Gnostic.

func (*Version) Descriptor deprecated

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

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetMajor

func (x *Version) GetMajor() int32

func (*Version) GetMinor

func (x *Version) GetMinor() int32

func (*Version) GetPatch

func (x *Version) GetPatch() int32

func (*Version) GetSuffix

func (x *Version) GetSuffix() string

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) ProtoReflect

func (x *Version) ProtoReflect() protoreflect.Message

func (*Version) Reset

func (x *Version) Reset()

func (*Version) String

func (x *Version) String() string

type Wrapper

type Wrapper struct {

	// version of the OpenAPI specification in which this extension was written.
	Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	// Name of the extension.
	ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"`
	// YAML-formatted extension value.
	Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"`
	// contains filtered or unexported fields
}

func (*Wrapper) Descriptor deprecated

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

Deprecated: Use Wrapper.ProtoReflect.Descriptor instead.

func (*Wrapper) GetExtensionName

func (x *Wrapper) GetExtensionName() string

func (*Wrapper) GetVersion

func (x *Wrapper) GetVersion() string

func (*Wrapper) GetYaml

func (x *Wrapper) GetYaml() string

func (*Wrapper) ProtoMessage

func (*Wrapper) ProtoMessage()

func (*Wrapper) ProtoReflect

func (x *Wrapper) ProtoReflect() protoreflect.Message

func (*Wrapper) Reset

func (x *Wrapper) Reset()

func (*Wrapper) String

func (x *Wrapper) String() string

Jump to

Keyboard shortcuts

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