parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DependencyBlockPublisher = "blockPublisher"
	DependencyJobScheduler   = "jobScheduler"
	DependencyLogger         = "logger"
	DependencyStdout         = "stdout"
	DependencyUserContext    = "userContext"
)

Variables

This section is empty.

Functions

func GetImportPath

func GetImportPath(file *ast.File, name string) string

func GetSchemaForType

func GetSchemaForType(parseCtx *Context, typeNode ast.Expr, pkg string, metadata *Metadata) (schema.Schema, bool, error)

func SortedImportKeys

func SortedImportKeys(imports map[string]string) []string

Types

type Context

type Context struct {
	WorkDir string
	FileSet *token.FileSet
	Parent  ast.Node
	File    *ast.File
}

func (*Context) WithFile

func (c *Context) WithFile(f *ast.File) *Context

func (*Context) WithParent

func (c *Context) WithParent(parent ast.Node) *Context

func (*Context) WithWorkdir

func (c *Context) WithWorkdir(workDir string) *Context

type Dependency

type Dependency struct {
	Name      string
	FieldName string
}

type Field

type Field struct {
	Dependency       string
	JSONPropertyName string
	Name             string
	ParameterName    string
	Required         bool
	ResultTypeFrom   bool
	Schema           schema.Schema
	Variadic         bool
}

func ParseField

func ParseField(
	parseCtx *Context,
	fieldName string,
	astField *ast.Field,
	pkg string,
	fileComments ...*ast.Comment,
) (*Field, error)

type Metadata

type Metadata struct {
	Description string
	Directives  []schema.Directive
}

func FindType

func FindType(parseCtx *Context, pkgName, name string) (*ast.File, ast.Expr, *Metadata, error)

func ParseMetadataFromComments

func ParseMetadataFromComments(comments []*goast.Comment) (*Metadata, error)

Jump to

Keyboard shortcuts

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