Documentation ¶
Index ¶
Constants ¶
View Source
const ( SchemaPrefix = "# @schema" CommentPrefix = "# " )
Variables ¶
This section is empty.
Functions ¶
func FixRequiredProperties ¶
Types ¶
type Schema ¶
type Schema struct { AdditionalProperties SchemaOrBool `yaml:"additionalProperties,omitempty" json:"additionalProperties,omitempty"` Default interface{} `yaml:"default,omitempty" json:"default,omitempty"` Then *Schema `yaml:"then,omitempty" json:"then,omitempty"` PatternProperties map[string]*Schema `yaml:"patternProperties,omitempty" json:"patternProperties,omitempty"` Properties map[string]*Schema `yaml:"properties,omitempty" json:"properties,omitempty"` If *Schema `yaml:"if,omitempty" json:"if,omitempty"` Minimum *int `yaml:"minimum,omitempty" json:"minimum,omitempty"` MultipleOf *int `yaml:"multipleOf,omitempty" json:"multipleOf,omitempty"` ExclusiveMaximum *int `yaml:"exclusiveMaximum,omitempty" json:"exclusiveMaximum,omitempty"` Items *Schema `yaml:"items,omitempty" json:"items,omitempty"` ExclusiveMinimum *int `yaml:"exclusiveMinimum,omitempty" json:"exclusiveMinimum,omitempty"` Maximum *int `yaml:"maximum,omitempty" json:"maximum,omitempty"` Else *Schema `yaml:"else,omitempty" json:"else,omitempty"` Pattern string `yaml:"pattern,omitempty" json:"pattern,omitempty"` Const interface{} `yaml:"const,omitempty" json:"const,omitempty"` Ref string `yaml:"$ref,omitempty" json:"$ref,omitempty"` Schema string `yaml:"$schema,omitempty" json:"$schema,omitempty"` Id string `yaml:"$id,omitempty" json:"$id,omitempty"` Format string `yaml:"format,omitempty" json:"format,omitempty"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Title string `yaml:"title,omitempty" json:"title,omitempty"` Type StringOrArrayOfString `yaml:"type,omitempty" json:"type,omitempty"` AnyOf []*Schema `yaml:"anyOf,omitempty" json:"anyOf,omitempty"` AllOf []*Schema `yaml:"allOf,omitempty" json:"allOf,omitempty"` OneOf []*Schema `yaml:"oneOf,omitempty" json:"oneOf,omitempty"` RequiredProperties []string `yaml:"-" json:"required,omitempty"` Examples []string `yaml:"examples,omitempty" json:"examples,omitempty"` Enum []string `yaml:"enum,omitempty" json:"enum,omitempty"` HasData bool `yaml:"-" json:"-"` Deprecated bool `yaml:"deprecated,omitempty" json:"deprecated,omitempty"` Required bool `yaml:"required,omitempty" json:"-"` }
Schema struct contains yaml tags for reading, json for writing (creating the jsonschema)
func GetSchemaFromComment ¶
GetSchemaFromComment parses the annotations from the given comment
func YamlToSchema ¶
func YamlToSchema( node *yaml.Node, keepFullComment bool, dontRemoveHelmDocsPrefix bool, skipAutoGeneration *SkipAutoGenerationConfig, parentRequiredProperties *[]string, ) Schema
YamlToSchema recursevly parses the given yaml.Node and creates a jsonschema from it
func (*Schema) DisableRequiredProperties ¶
func (s *Schema) DisableRequiredProperties()
DisableRequiredProperties sets all RequiredProperties in this schema to an empty slice
type SchemaOrBool ¶
type SchemaOrBool interface{}
type SkipAutoGenerationConfig ¶
type SkipAutoGenerationConfig struct {
Title, Description, Required, Default, AdditionalProperties bool
}
func NewSkipAutoGenerationConfig ¶
func NewSkipAutoGenerationConfig(flag []string) (*SkipAutoGenerationConfig, error)
type StringOrArrayOfString ¶
type StringOrArrayOfString []string
func (*StringOrArrayOfString) IsEmpty ¶
func (s *StringOrArrayOfString) IsEmpty() bool
func (*StringOrArrayOfString) MarshalJSON ¶
func (s *StringOrArrayOfString) MarshalJSON() ([]byte, error)
func (*StringOrArrayOfString) Matches ¶
func (s *StringOrArrayOfString) Matches(typeString string) bool
func (*StringOrArrayOfString) UnmarshalYAML ¶
func (s *StringOrArrayOfString) UnmarshalYAML(value *yaml.Node) error
func (*StringOrArrayOfString) Validate ¶
func (s *StringOrArrayOfString) Validate() error
Click to show internal directories.
Click to hide internal directories.