plugin

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonPlugin

type JsonPlugin struct {
	// contains filtered or unexported fields
}

func NewJsonPlugin added in v0.2.0

func NewJsonPlugin() *JsonPlugin

func (*JsonPlugin) LoadSpec

func (j *JsonPlugin) LoadSpec(reader io.Reader) (SpecData, error)

func (*JsonPlugin) LoadSpecFile

func (j *JsonPlugin) LoadSpecFile(path string) (SpecData, error)

func (*JsonPlugin) LoadSpecUrl added in v0.2.0

func (j *JsonPlugin) LoadSpecUrl(url string) (SpecData, error)

func (*JsonPlugin) Name added in v0.2.0

func (j *JsonPlugin) Name() string

type OpenApiPlugin

type OpenApiPlugin struct {
	// contains filtered or unexported fields
}

func NewOpenApiPlugin added in v0.2.4

func NewOpenApiPlugin() *OpenApiPlugin

func (*OpenApiPlugin) LoadSpec

func (o *OpenApiPlugin) LoadSpec(reader io.Reader) (SpecData, error)

func (*OpenApiPlugin) LoadSpecFile

func (o *OpenApiPlugin) LoadSpecFile(path string) (SpecData, error)

func (*OpenApiPlugin) LoadSpecUrl added in v0.2.0

func (o *OpenApiPlugin) LoadSpecUrl(url string) (SpecData, error)

func (*OpenApiPlugin) Name added in v0.2.0

func (o *OpenApiPlugin) Name() string

type Plugin

type Plugin interface {
	// Name returns the name of the plugin
	// The name should be unique among the plugins.
	Name() string
	// LoadSpecFile loads a spec file from the given path.
	// The path is absolute path or relative from current working directory(not from `render.star`) to the spec file.
	LoadSpecFile(path string) (SpecData, error)
	LoadSpec(reader io.Reader) (SpecData, error)
	LoadSpecUrl(url string) (SpecData, error)
}

type Plugins

type Plugins interface {
	// GetPlugin provide Plugin by its name
	GetPlugin(pluginName string) Plugin
}

func NewPlugins

func NewPlugins() Plugins

type ProtobufPlugin

type ProtobufPlugin struct {
	// contains filtered or unexported fields
}

func NewProtobufPlugin

func NewProtobufPlugin() *ProtobufPlugin

func (*ProtobufPlugin) LoadSpec

func (p *ProtobufPlugin) LoadSpec(reader io.Reader) (SpecData, error)

func (*ProtobufPlugin) LoadSpecFile

func (p *ProtobufPlugin) LoadSpecFile(path string) (SpecData, error)

func (*ProtobufPlugin) LoadSpecUrl added in v0.2.0

func (p *ProtobufPlugin) LoadSpecUrl(url string) (SpecData, error)

func (*ProtobufPlugin) Name added in v0.2.0

func (p *ProtobufPlugin) Name() string

type SpecData

type SpecData any

SpecData represent the data of a specification. it can be any type, depending on the plugin. For example, OpenAPI plugin uses go-openapi/loads.Spec() to load a spec file.

The SpecData loaded by plugin is flattened to a map[string]interface{} via encoding/json/json.Marshal and json.Unmarshal for security. Thus, the field of SpecData that is not exported will not be exposed on rendering.

type YamlPlugin

type YamlPlugin struct {
	// contains filtered or unexported fields
}

func NewYamlPlugin added in v0.2.0

func NewYamlPlugin() *YamlPlugin

func (*YamlPlugin) LoadSpec

func (y *YamlPlugin) LoadSpec(reader io.Reader) (SpecData, error)

func (*YamlPlugin) LoadSpecFile

func (y *YamlPlugin) LoadSpecFile(path string) (SpecData, error)

func (*YamlPlugin) LoadSpecUrl added in v0.2.0

func (y *YamlPlugin) LoadSpecUrl(url string) (SpecData, error)

func (*YamlPlugin) Name added in v0.2.0

func (y *YamlPlugin) Name() string

Jump to

Keyboard shortcuts

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