Documentation ¶
Index ¶
- Variables
- func Generate(crd *SchemaType, w io.WriteCloser, enableComments, minimal, skipRandom bool) (err error)
- func LoadTemplates() error
- func RenderContent(w io.WriteCloser, crds []*SchemaType, opts RenderOpts) (err error)
- type CRDVersion
- type Group
- type GroupPage
- type Index
- type Parser
- type Property
- type RenderOpts
- type Rendering
- type SchemaType
- type Validation
- type Version
- type ViewPage
Constants ¶
This section is empty.
Variables ¶
var RootRequiredFields = []string{"apiVersion", "kind", "spec", "metadata", "status"}
Functions ¶
func Generate ¶
func Generate(crd *SchemaType, w io.WriteCloser, enableComments, minimal, skipRandom bool) (err error)
Generate takes a CRD content and path, and outputs.
func LoadTemplates ¶ added in v0.4.0
func LoadTemplates() error
LoadTemplates creates a map of loaded templates that are primed and ready to be rendered.
func RenderContent ¶ added in v0.4.0
func RenderContent(w io.WriteCloser, crds []*SchemaType, opts RenderOpts) (err error)
RenderContent creates an HTML website from the CRD content.
Types ¶
type CRDVersion ¶ added in v1.0.0
type CRDVersion struct { Name string Schema *v1beta1.JSONSchemaProps }
CRDVersion corresponds to a CRD version.
type GroupPage ¶ added in v1.0.3
type GroupPage struct {
Groups []Group
}
GroupPage will have a list of groups and inside these groups will be a list of page views.
type Parser ¶ added in v0.5.0
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶ added in v0.5.0
NewParser creates a new parser contains most of the things that do not change over each call.
func (*Parser) ParseProperties ¶ added in v0.5.0
func (p *Parser) ParseProperties(version string, file io.Writer, properties map[string]v1beta1.JSONSchemaProps, requiredFields []string) error
ParseProperties takes a writer and puts out any information / properties it encounters during the runs. It will recursively parse every "properties:" and "additionalProperties:". Using the types, it will also output some sample data based on those types.
type Property ¶
type Property struct { Name string Description string Type string Nullable bool Patterns string Format string Indent int Version string Default string Required bool Properties []*Property Enums string }
Property builds up a Tree structure of embedded things.
type RenderOpts ¶ added in v1.0.3
type Rendering ¶ added in v1.0.3
type Rendering struct { // Group defines which group this schema should belong to. If empty // the schema's version will be used as grouping information. Group string }
Rendering provides extra rendering information of this schema.
type SchemaType ¶ added in v1.0.0
type SchemaType struct { Schema *v1beta1.JSONSchemaProps Versions []*CRDVersion Validation *Validation Group string Kind string Rendering Rendering }
SchemaType is a wrapper around any kind of object that provide the following: - kind - group - name - openAPIV3Schema.
func ExtractSchemaType ¶ added in v1.0.0
func ExtractSchemaType(obj *unstructured.Unstructured) (*SchemaType, error)
ExtractSchemaType makes sure the following required fields are present in the unstructured data and creates are own internal representation: - spec - spec.names.kind - spec.group either: - versions
- version.Schema.OpenAPIV3Schema
- validation // if versions is missing
- validation.OpenAPIV3Schema
type Validation ¶ added in v1.0.0
type Validation struct { Name string Schema *v1beta1.JSONSchemaProps }
Validation is a set of validation rules that should be applied to all versions.