Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct { // Original definition SwaggerDefinition openapi_spec.Schema // Name of the package where the object declared by this Definition is going // to be located **after** the split is done PackageName string // Name of the type that will identify the object declared by this Definition // **after** the split is done TypeName string // contains filtered or unexported fields }
Wrapper around a Swagger Definition
func NewDefinition ¶
func NewDefinition(definition openapi_spec.Schema, id string) (*Definition, error)
func (*Definition) GeneratePatchedOpenAPIDef ¶
func (d *Definition) GeneratePatchedOpenAPIDef(gitRepo string, interfaces *InterfaceRegistry) (openapi_spec.Schema, error)
type InterfaceRegistry ¶
type InterfaceRegistry struct {
// contains filtered or unexported fields
}
Keeps track of all the `interface` objects that are defined inside of the project
func NewInterfaceRegistry ¶
func NewInterfaceRegistry() InterfaceRegistry
func (*InterfaceRegistry) Dump ¶
func (r *InterfaceRegistry) Dump()
func (*InterfaceRegistry) IsInterface ¶
func (r *InterfaceRegistry) IsInterface(gitRepo, module, name string) bool
returns true if this is a known interface, false otherwise * `gitRepo`: repository that will contain the generated code: i.e. `github.com/kubewarden/k8s-objects` * `module`: name of the module where the type is defined * `name`: name of the type
func (*InterfaceRegistry) RegisterInterface ¶
func (r *InterfaceRegistry) RegisterInterface(module, name string)
keep track of the interfaced called `name`, defined inside of the `module` module
type Package ¶
type Package struct { // name of the package, after the split Name string // List of definitions provided by this module Definitions []*Definition // list of package names this one depends on Dependencies mapset.Set[string] }
func NewPackage ¶
func (*Package) AddDefinitionRefactoringPlan ¶
func (p *Package) AddDefinitionRefactoringPlan(definition *Definition)
func (*Package) GenerateSwagger ¶
func (p *Package) GenerateSwagger(swaggerVersion, kubernetesVersion, gitRepo string, interfaces *InterfaceRegistry) (openapi_spec.Swagger, error)
type PropertyImport ¶
func NewPropertyImportFromRef ¶
func NewPropertyImportFromRef(ref *openapi_spec.Ref) (PropertyImport, error)
Given a `ref` string like: `/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector` return:
`propertyImport"{ package_name: "apimachinery/pkg/apis/meta/v1", alias: "apimachinery_pkgs_apis_meta_v1", type_name: "LabelSelector", }
func (*PropertyImport) IsEmpty ¶
func (p *PropertyImport) IsEmpty() bool
func (*PropertyImport) ToMap ¶
func (p *PropertyImport) ToMap(gitRepo string) map[string]interface{}
Convert PropertyImport into a swagger x-go-type interface * `gitRepo`: name of the repository that is going to host the code, e.g. `github.com/kubewarden/k8s-objects`