Documentation
¶
Index ¶
- func DefaultNameSystem() string
- func GetModelNameTargets(context *generator.Context, args *args.Args, boilerplate []byte) []generator.Target
- func GetOpenAPITargets(context *generator.Context, args *args.Args, boilerplate []byte) []generator.Target
- func NameSystems() namer.NameSystems
- func NewSchemaNameGen(outputFilename, targetPackage string, openAPISchemaNamePackage string) generator.Generator
- func ParseCommentTags(t *types.Type, comments []string, prefix string) (*spec.Schema, error)
- type APIRule
- type CELTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 GetModelNameTargets ¶
func GetModelNameTargets(context *generator.Context, args *args.Args, boilerplate []byte) []generator.Target
GetModelNameTargets returns the targets for model name generation.
func GetOpenAPITargets ¶
func GetOpenAPITargets(context *generator.Context, args *args.Args, boilerplate []byte) []generator.Target
GetOpenAPITargets returns the targets for OpenAPI definition generation.
func NameSystems ¶
func NameSystems() namer.NameSystems
NameSystems returns the name system used by the generators in this package.
func NewSchemaNameGen ¶
func NewSchemaNameGen(outputFilename, targetPackage string, openAPISchemaNamePackage string) generator.Generator
NewSchemaNameGen creates a generator
func ParseCommentTags ¶
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"`
}