parser

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Directives

func Directives() ([]byte, error)

func KloudliteK8sTypes

func KloudliteK8sTypes() ([]byte, error)

func RestoreSanitizedPackagePath

func RestoreSanitizedPackagePath(sanitizedPath string) string

func SanitizePackagePath

func SanitizePackagePath(pkgPath string) string

func ScalarTypes

func ScalarTypes() ([]byte, error)

Types

type Field

type Field struct {
	ParentName  string
	Name        string
	PkgPath     string
	Type        reflect.Type
	StructName  string
	Fields      *[]string
	InputFields *[]string

	Parser *parser

	JsonTag
	GraphqlTag
}

type GraphqlTag

type GraphqlTag struct {
	Uri               *string
	Enum              []string
	Ignore            bool
	NoInput           bool
	OnlyInput         bool
	InputOmitEmpty    bool
	DefaultValue      any
	ChildrenRequired  bool
	ChildrenOmitEmpty bool
	ScalarType        *string
}

type GraphqlType

type GraphqlType string
const (
	Type  GraphqlType = "type"
	Input GraphqlType = "input"
	Enum  GraphqlType = "enum"
)

type JsonTag

type JsonTag struct {
	Value     string
	OmitEmpty bool
	Inline    bool
}

type Parser

type Parser interface {
	GenerateGraphQLSchema(structName string, name string, t reflect.Type, parentTag GraphqlTag) error
	LoadStruct(name string, data any) error

	PrintTypes(w io.Writer)
	PrintCommonTypes(w io.Writer)

	DebugSchema(w io.Writer)
	DumpSchema(dir string) error
	WithPagination(types []string)
}

func NewParser

func NewParser(cli SchemaClient) Parser

func NewUnsafeParser

func NewUnsafeParser(strucs map[string]*Struct, cli SchemaClient) Parser

type SchemaClient

type SchemaClient interface {
	GetK8sJsonSchema(name string) (*apiExtensionsV1.JSONSchemaProps, error)
	GetHttpJsonSchema(url string) (*apiExtensionsV1.JSONSchemaProps, error)
}

type Struct

type Struct struct {
	TypeDirectives map[string]struct{}
	Types          map[string][]string
	Inputs         map[string][]string
	Enums          map[string][]string
}

func (*Struct) WriteSchema

func (s *Struct) WriteSchema(w io.Writer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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