Documentation ¶
Overview ¶
Package docs provides useful functions for creating documentation from Benthos components
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentSpec ¶
type ComponentSpec struct { // Name of the component Name string // Type of the component (input, output, etc) Type string // Description of the component (in markdown). Description string Fields FieldSpecs }
ComponentSpec describes a Benthos component.
func (*ComponentSpec) AsMarkdown ¶
func (c *ComponentSpec) AsMarkdown(fullConfigExample interface{}) ([]byte, error)
AsMarkdown renders the spec of a component, along with a full configuration example, into a markdown document.
type FieldSpec ¶
type FieldSpec struct { // Description of the field purpose (in markdown). Description string // Advanced is true for optional fields that will not be present in most // configs. Advanced bool // Deprecated is true for fields that are deprecated and only exist for // backwards compatibility reasons. Deprecated bool // Examples is a slice of optional example values for a field. Examples []interface{} }
FieldSpec describes a component config field.
func FieldAdvanced ¶
FieldAdvanced returns a field spec for an advanced field.
func FieldCommon ¶
FieldCommon returns a field spec for a common field.
func FieldDeprecated ¶
func FieldDeprecated() FieldSpec
FieldDeprecated returns a field spec for a deprecated field.
type FieldSpecs ¶
FieldSpecs is a map of field specs for a component.
func (FieldSpecs) ConfigAdvanced ¶
func (f FieldSpecs) ConfigAdvanced(config map[string]interface{}) map[string]interface{}
ConfigAdvanced takes a sanitised configuration of a component, a map of field docs, and removes all fields that are deprecated.
func (FieldSpecs) ConfigCommon ¶
func (f FieldSpecs) ConfigCommon(config map[string]interface{}) map[string]interface{}
ConfigCommon takes a sanitised configuration of a component, a map of field docs, and removes all fields that aren't common or are deprecated.