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) 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) 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
Click to show internal directories.
Click to hide internal directories.