Documentation ¶
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func GoPackageByPath(path, vendorPath string) (string, error)
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Config
- type FieldConfig
- type MethodConfig
- type ObjectConfig
- type ParamConfig
- type Plugin
- func (Plugin) Generate() error
- func (p *Plugin) Infos() map[string]string
- func (p *Plugin) Init(config *generator.GenerateConfig, plugins []generator.Plugin) error
- func (Plugin) Name() string
- func (p *Plugin) Prepare() error
- func (p *Plugin) PrintInfo(info generator.Infos)
- func (p *Plugin) TypeInputTypeResolver(typeFile *parsedFile, typ parser.Type) (graphql.TypeResolver, error)
- func (p *Plugin) TypeOutputTypeResolver(typeFile *parsedFile, typ parser.Type, required bool) (graphql.TypeResolver, error)
- func (p *Plugin) TypeValueResolver(file *parsedFile, typ parser.Type, required bool, ctxKey string) (_ graphql.ValueResolver, withErr, fromArgs bool, err error)
- type ProviderConfig
- type SwaggerFileConfig
- func (pc *SwaggerFileConfig) FieldConfig(objName string, fieldName string) (FieldConfig, error)
- func (pc *SwaggerFileConfig) GetGQLMessagePrefix() string
- func (pc *SwaggerFileConfig) GetName() string
- func (pc *SwaggerFileConfig) GetObjects() []map[string]ObjectConfig
- func (pc *SwaggerFileConfig) GetOutputPath() string
- func (pc *SwaggerFileConfig) GetOutputPkg() string
- func (pc *SwaggerFileConfig) GetPath() string
- func (pc *SwaggerFileConfig) GetTags() map[string]*TagConfig
- func (pc *SwaggerFileConfig) ObjectConfig(objName string) (ObjectConfig, error)
- type TagConfig
Constants ¶
const ( PluginName = "swagger2gql" PluginConfigKey = "swagger2gql" PluginImportConfigKey = "swagger2gql_files" )
Variables ¶
var ErrMultipleSuccessResponses = errors.New("method contains multiple success responses")
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func GoPackageByPath ¶
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Config ¶
type Config struct { Files []*SwaggerFileConfig `mapstructure:"files"` OutputPath string `mapstructure:"output_path"` Messages []map[string]ObjectConfig `mapstructure:"messages"` }
func (*Config) GetOutputPath ¶
type FieldConfig ¶
type FieldConfig struct {
ContextKey string `mapstructure:"context_key"`
}
type MethodConfig ¶
type MethodConfig struct { Alias string `mapstructure:"alias"` RequestType string `mapstructure:"request_type"` // QUERY | MUTATION DataLoaderProvider ProviderConfig `mapstructure:"data_loader_provider"` }
type ObjectConfig ¶
type ObjectConfig struct { Fields map[string]FieldConfig `mapstructure:"fields"` DataLoaders []dataloader.FieldConfig `mapstructure:"data_loaders"` }
type ParamConfig ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) TypeInputTypeResolver ¶
func (*Plugin) TypeOutputTypeResolver ¶
type ProviderConfig ¶
type SwaggerFileConfig ¶
type SwaggerFileConfig struct { Name string `mapstructure:"name"` Path string `mapstructure:"path"` ModelsGoPath string `mapstructure:"models_go_path"` OutputPkg string `mapstructure:"output_package"` OutputPath string `mapstructure:"output_path"` GQLObjectsPrefix string `mapstructure:"gql_objects_prefix"` Tags map[string]*TagConfig `mapstructure:"tags"` Objects []map[string]ObjectConfig `mapstructure:"objects"` ParamsConfig []ParamConfig `mapstructure:"params_config"` }
func (*SwaggerFileConfig) FieldConfig ¶
func (pc *SwaggerFileConfig) FieldConfig(objName string, fieldName string) (FieldConfig, error)
func (*SwaggerFileConfig) GetGQLMessagePrefix ¶
func (pc *SwaggerFileConfig) GetGQLMessagePrefix() string
func (*SwaggerFileConfig) GetName ¶
func (pc *SwaggerFileConfig) GetName() string
func (*SwaggerFileConfig) GetObjects ¶
func (pc *SwaggerFileConfig) GetObjects() []map[string]ObjectConfig
func (*SwaggerFileConfig) GetOutputPath ¶
func (pc *SwaggerFileConfig) GetOutputPath() string
func (*SwaggerFileConfig) GetOutputPkg ¶
func (pc *SwaggerFileConfig) GetOutputPkg() string
func (*SwaggerFileConfig) GetPath ¶
func (pc *SwaggerFileConfig) GetPath() string
func (*SwaggerFileConfig) GetTags ¶
func (pc *SwaggerFileConfig) GetTags() map[string]*TagConfig
func (*SwaggerFileConfig) ObjectConfig ¶
func (pc *SwaggerFileConfig) ObjectConfig(objName string) (ObjectConfig, error)