api

package
v0.0.0-...-c8b48d0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEndpointOverrides

func ApplyEndpointOverrides(endpoint *spec.Endpoint, overrides *EndpointOverrides) *spec.Endpoint

ApplyEndpointOverrides will return a mutated spec.Endpoint with the given EndpointOverrides applied.

func ApplyFieldOverrides

func ApplyFieldOverrides(field spec.Field, overrides *FieldOverrides) spec.Field

ApplyFieldOverrides will return a mutated spec.Field with the given FieldOverrides applied.

func ApplyObjectOverrides

func ApplyObjectOverrides(object *spec.Object, overrides *ObjectOverrides) *spec.Object

func ApplyOverrides

func ApplyOverrides(endpoints []*spec.Endpoint, overrides Overrides) []*spec.Endpoint

func RemoveGeneratedFiles

func RemoveGeneratedFiles(ctx context.Context, outputDir string) error

Types

type EndpointActionsOverrides

type EndpointActionsOverrides struct {
	DisableCreate *bool `yaml:"disableCreate,omitempty"`
	DisableDelete *bool `yaml:"disableDelete,omitempty"`
	DisableGet    *bool `yaml:"disableGet,omitempty"`
	DisableList   *bool `yaml:"disableList,omitempty"`
	DisableUpdate *bool `yaml:"disableUpdate,omitempty"`
}

type EndpointOverrides

type EndpointOverrides struct {
	Name *string `yaml:"name,omitempty"`

	Actions      *EndpointActionsOverrides   `yaml:"actions,omitempty"`
	Objects      map[string]*ObjectOverrides `yaml:"objects,omitempty"`
	ResourcePath *string                     `yaml:"resourcePath,omitempty"`
}

type FieldOverrides

type FieldOverrides struct {
	Description *string `yaml:"description,omitempty"`

	// GenerateDefaultDescription indicates whether the default description for the field should be set. When this is not
	// set it defaults to `true`.
	//
	// The behaviour of this is strongly linked to Description. When this is true and Description is set, even to an
	// empty string, then the Description will override the default description. If Description is nil then this will
	// generate the default description.
	//
	// To remove the default description from the field without having to set Description to an empty string this should
	// be set to false.
	GenerateDefaultDescription *bool           `yaml:"generateDefaultDescription,omitempty"`
	JSONName                   *string         `yaml:"jsonName,omitempty"`
	Name                       *string         `yaml:"name,omitempty"`
	Type                       *spec.FieldType `yaml:"type,omitempty"`
	Validation                 *regexp.Regexp  `yaml:"validation,omitempty"`
}

type ObjectOverrides

type ObjectOverrides struct {
	Name             *string                    `yaml:"name,omitempty"`
	AdditionalFields map[string]*FieldOverrides `yaml:"additionalFields,omitempty"`
	Fields           map[string]*FieldOverrides `yaml:"fields,omitempty"`
}

type Overrides

type Overrides struct {
	Endpoints map[string]*EndpointOverrides `yaml:"endpoints"`
}

type Parser

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

func NewParser

func NewParser(config ParserConfig) *Parser

func (*Parser) ParseDir

func (p *Parser) ParseDir(ctx context.Context, dir string) ([]*spec.Endpoint, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(ctx context.Context, filename string) ([]*spec.Endpoint, error)

type ParserConfig

type ParserConfig struct {
	Endpoints    map[string]ParserEndpointConfig `yaml:"endpoints"`
	SkippedFiles []string                        `yaml:"skippedFiles"`
}

func (*ParserConfig) GetEndpoint

func (p *ParserConfig) GetEndpoint(name string) ParserEndpointConfig

type ParserEndpointConfig

type ParserEndpointConfig struct {
	Skip bool `yaml:"skip"`
}

type Renderer

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

func NewRenderer

func NewRenderer() (*Renderer, error)

func (*Renderer) RenderClient

func (r *Renderer) RenderClient(ctx context.Context, endpoints []*spec.Endpoint, targetDir, packageName string) error

func (*Renderer) RenderEndpoint

func (r *Renderer) RenderEndpoint(ctx context.Context, endpoint *spec.Endpoint, targetDir, packageName string) error

func (*Renderer) RenderEndpoints

func (r *Renderer) RenderEndpoints(ctx context.Context, endpoints []*spec.Endpoint, targetDir, packageName string) error

Jump to

Keyboard shortcuts

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