composite

package
v0.0.0-...-2bfcbe5 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Code generated by internal/cmd/embedtmpl/embedtmpl.go DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlanAllOfObject

func PlanAllOfObject(ctx context.Context, helper gen.Helper, schema *gen.Schema) (gen.Plan, error)

PlanAllOfObject attempts to generate a Plan from the AllOf schemas on an object; if it doesn't match, ErrContinue is returned.

func PlanDiscriminatedOneOfObject

func PlanDiscriminatedOneOfObject(ctx context.Context, helper gen.Helper, schema *gen.Schema) (gen.Plan, error)

PlanDiscriminatedOneOfObject generates a value for a oneOf array of object schemas, provided discriminator config has been provided; if it doesn't match, ErrContinue is returned.

func PlanObject

func PlanObject(ctx context.Context, helper gen.Helper, schema *gen.Schema) (gen.Plan, error)

PlanObject returns a plan if the provided type is an object; otherwise it returns ErrContinue

func PlanOneOfDiffTypes

func PlanOneOfDiffTypes(ctx context.Context, helper gen.Helper, schema *gen.Schema) (gen.Plan, error)

PlanOneOfDiffTypes attempts to generate a plan for a schema which is a `oneOf` with multiple schemas of different primitive JSON types. Because there is no way of discriminating between values of the same type, all values must be of different types.

Types

type StructField

type StructField struct {
	Comment         string
	Name            string
	JSONName        string
	Type            gen.TypeInfo
	Tag             string
	Required        bool
	FieldValidators []validator.Validator
}

StructField contains information about how a struct's field should be rendered

func (StructField) Validators

func (s StructField) Validators() []validator.Validator

Validators returns the validators for this field

type StructPlan

type StructPlan struct {
	TypeInfo gen.TypeInfo
	ID       *url.URL

	Comment     string
	Fields      []StructField
	SubRequired []StructField
	Traits      []Trait
}

StructPlan is an implementation of the interface Plan specific to structs

func (*StructPlan) Deps

func (s *StructPlan) Deps() (deps []gen.TypeInfo)

Deps returns all known required imported symbols for this plan

func (*StructPlan) Execute

func (s *StructPlan) Execute(imp *gen.Imports) (string, error)

Execute executes the provided struct plan and returns it rendered as a string

func (*StructPlan) Type

func (s *StructPlan) Type() gen.TypeInfo

Type returns the calculated type info for this struct

type Trait

type Trait interface {
	Template() string
}

Trait encapsulates customization of the struct's behavior (usually around serialization and deserialization)

Jump to

Keyboard shortcuts

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