extractors

package
v0.0.0-...-35c18bc Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindSchemaValidationByValidateBytes

func BindSchemaValidationByValidateBytes(s *jsonschema.Schema, typ typesutil.Type, validateBytes []byte) error

func BindSchemaValidationByValidator

func BindSchemaValidationByValidator(s *jsonschema.Schema, v validator.Validator)

func PropSchemaFromStructField

func PropSchemaFromStructField(ctx context.Context, field typesutil.StructField, required bool) *jsonschema.Schema

func Register

func Register(key string, getter OpenAPISchemaGetter)

func SchemaFrom

func SchemaFrom(v interface{}, optionFns ...SchemaFromOptFn) (s *jsonschema.Schema)

func SchemaFromType

func SchemaFromType(ctx context.Context, t typesutil.Type, def bool) (s *jsonschema.Schema)

func WithDocGetter

func WithDocGetter(ctx context.Context, docGetter DocGetter) context.Context

Types

type Definitions

type Definitions map[string]OpenAPISchemaGetter

func (Definitions) Ref

type DocGetter

type DocGetter interface {
	Doc(p token.Pos) (map[string][]string, []string)
}

func DocGetterFromContext

func DocGetterFromContext(ctx context.Context) DocGetter

type OpenAPISchemaFormatGetter

type OpenAPISchemaFormatGetter interface {
	OpenAPISchemaFormat() string
}

type OpenAPISchemaGetter

type OpenAPISchemaGetter interface {
	OpenAPISchema(ref func(t string) jsonschema.Refer) *jsonschema.Schema
}

func Get

func Get(key string) (OpenAPISchemaGetter, bool)

func OpenAPISchemaGetterFromGoType

func OpenAPISchemaGetterFromGoType(ctx context.Context, types types.Type, def bool) OpenAPISchemaGetter

func OpenAPISchemaGetterFromReflectType

func OpenAPISchemaGetterFromReflectType(ctx context.Context, t reflect.Type) OpenAPISchemaGetter

type OpenAPISchemaTypeGetter

type OpenAPISchemaTypeGetter interface {
	OpenAPISchemaType() []string
}

type SchemaFromOptFn

type SchemaFromOptFn = func(o *opt)

func SchemaFromOptRef

func SchemaFromOptRef(ref func(t string) jsonschema.Refer) SchemaFromOptFn

type TypeName

type TypeName string

func (TypeName) RefString

func (t TypeName) RefString() string

Jump to

Keyboard shortcuts

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