builder

package
v0.24.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 31 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOpenAPIV2 added in v0.23.0

func BuildOpenAPIV2(crd *apiextensionsv1.CustomResourceDefinition, version string, opts Options) (*spec.Swagger, error)

BuildOpenAPIV2 builds OpenAPI v2 for the given crd in the given version

func BuildOpenAPIV3 added in v0.23.0

func BuildOpenAPIV3(crd *apiextensionsv1.CustomResourceDefinition, version string, opts Options) (*spec3.OpenAPI, error)

func MergeSpecs

func MergeSpecs(staticSpec *spec.Swagger, crdSpecs ...*spec.Swagger) (*spec.Swagger, error)

MergeSpecs aggregates all OpenAPI specs, reusing the metadata of the first, static spec as the basis. The static spec has the highest priority, and its paths and definitions won't get overlapped by user-defined CRDs. None of the input is mutated, but input and output share data structures.

func MergeSpecsV3 added in v0.23.0

func MergeSpecsV3(crdSpecs ...*spec3.OpenAPI) (*spec3.OpenAPI, error)

MergeSpecsV3 merges OpenAPI v3 specs for CRDs For V3, the static spec is never merged with the individual CRD specs so no conflict resolution is necessary

Types

type CRDCanonicalTypeNamer

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

CRDCanonicalTypeNamer implements CanonicalTypeNamer interface for CRDs to seed kube-openapi canonical type name without Go types

func (*CRDCanonicalTypeNamer) OpenAPICanonicalTypeName

func (c *CRDCanonicalTypeNamer) OpenAPICanonicalTypeName() string

OpenAPICanonicalTypeName returns canonical type name for given CRD

type Options

type Options struct {
	// Convert to OpenAPI v2.
	V2 bool

	// Only takes effect if the flag and V2 and both set to true. If the condition is reached,
	// publish OpenAPI V2 but skip running the spec through ToStructuralOpenAPIV2
	// This prevents XPreserveUnknownFields:true fields from being cleared
	// Used only by server side apply
	SkipFilterSchemaForKubectlOpenAPIV2Validation bool

	// Strip value validation.
	StripValueValidation bool

	// Strip nullable.
	StripNullable bool

	// AllowNonStructural indicates swagger should be built for a schema that fits into the structural type but does not meet all structural invariants
	AllowNonStructural bool
}

Options contains builder options.

Jump to

Keyboard shortcuts

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