kube-openapik8s.io/kube-openapi/pkg/generators Index | Files | Directories

package generators

import "k8s.io/kube-openapi/pkg/generators"

Index

Functions

func DefaultNameSystem

func DefaultNameSystem() string

DefaultNameSystem returns the default name system for ordering the types to be processed by the generators in this package.

func GetTargets

func GetTargets(context *generator.Context, args *args.Args) []generator.Target

func NameSystems

func NameSystems() namer.NameSystems

NameSystems returns the name system used by the generators in this package.

func ParseCommentTags

func ParseCommentTags(t *types.Type, comments []string, prefix string) (*spec.Schema, error)

ParseCommentTags parses the given comments into a CommentTags type. Validates the parsed comment tags, and returns the result. Accepts an optional type to validate against, and a prefix to filter out markers not related to validation. Accepts a prefix to filter out markers not related to validation. Returns any errors encountered while parsing or validating the comment tags.

Types

type APIRule

type APIRule interface {
	// Validate evaluates API rule on type t and returns a list of field names in
	// the type that violate the rule. Empty field name [""] implies the entire
	// type violates the rule.
	Validate(t *types.Type) ([]string, error)

	// Name returns the name of APIRule
	Name() string
}

APIRule is the interface for validating API rule on Go types

type CELTag

type CELTag struct {
	Rule              string `json:"rule,omitempty"`
	Message           string `json:"message,omitempty"`
	MessageExpression string `json:"messageExpression,omitempty"`
	OptionalOldSelf   *bool  `json:"optionalOldSelf,omitempty"`
	Reason            string `json:"reason,omitempty"`
	FieldPath         string `json:"fieldPath,omitempty"`
}

func (*CELTag) Validate

func (c *CELTag) Validate() error

Source Files

api_linter.go config.go enum.go extension.go markers.go openapi.go union.go

Directories

PathSynopsis
pkg/generators/rulesPackage rules contains API rules that are enforced in OpenAPI spec generation as part of the machinery.
Version
v0.0.0-20250318190949-c8a335a9a2ff (latest)
Published
Mar 18, 2025
Platform
linux/amd64
Imports
23 packages
Last checked
4 weeks ago

Tools for package owners.