parser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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