gnostic_extension_v1

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 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 added in v0.0.3

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

Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead.

func (*ExtensionHandlerRequest) GetCompilerVersion added in v0.0.3

func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version

func (*ExtensionHandlerRequest) GetWrapper added in v0.0.3

func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper

func (*ExtensionHandlerRequest) ProtoMessage added in v0.0.3

func (*ExtensionHandlerRequest) ProtoMessage()

func (*ExtensionHandlerRequest) ProtoReflect added in v0.0.3

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

func (*ExtensionHandlerRequest) Reset added in v0.0.3

func (x *ExtensionHandlerRequest) Reset()

func (*ExtensionHandlerRequest) String added in v0.0.3

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 added in v0.0.3

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

Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead.

func (*ExtensionHandlerResponse) GetErrors added in v0.0.3

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

func (*ExtensionHandlerResponse) GetHandled added in v0.0.3

func (x *ExtensionHandlerResponse) GetHandled() bool

func (*ExtensionHandlerResponse) GetValue added in v0.0.3

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

func (*ExtensionHandlerResponse) ProtoMessage added in v0.0.3

func (*ExtensionHandlerResponse) ProtoMessage()

func (*ExtensionHandlerResponse) ProtoReflect added in v0.0.3

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

func (*ExtensionHandlerResponse) Reset added in v0.0.3

func (x *ExtensionHandlerResponse) Reset()

func (*ExtensionHandlerResponse) String added in v0.0.3

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 added in v0.0.3

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

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetMajor added in v0.0.3

func (x *Version) GetMajor() int32

func (*Version) GetMinor added in v0.0.3

func (x *Version) GetMinor() int32

func (*Version) GetPatch added in v0.0.3

func (x *Version) GetPatch() int32

func (*Version) GetSuffix added in v0.0.3

func (x *Version) GetSuffix() string

func (*Version) ProtoMessage added in v0.0.3

func (*Version) ProtoMessage()

func (*Version) ProtoReflect added in v0.0.3

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

func (*Version) Reset added in v0.0.3

func (x *Version) Reset()

func (*Version) String added in v0.0.3

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 added in v0.0.3

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

Deprecated: Use Wrapper.ProtoReflect.Descriptor instead.

func (*Wrapper) GetExtensionName added in v0.0.3

func (x *Wrapper) GetExtensionName() string

func (*Wrapper) GetVersion added in v0.0.3

func (x *Wrapper) GetVersion() string

func (*Wrapper) GetYaml added in v0.0.3

func (x *Wrapper) GetYaml() string

func (*Wrapper) ProtoMessage added in v0.0.3

func (*Wrapper) ProtoMessage()

func (*Wrapper) ProtoReflect added in v0.0.3

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

func (*Wrapper) Reset added in v0.0.3

func (x *Wrapper) Reset()

func (*Wrapper) String added in v0.0.3

func (x *Wrapper) String() string

Jump to

Keyboard shortcuts

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