Documentation
¶
Index ¶
- func GetMethod(field *codegen.Field, defaultMethod string) string
- func GetSelection(objects *codegen.Objects, field *codegen.Field, refer bool) string
- func GetURL(field *codegen.Field) string
- func IsIgnoreField(field *codegen.Field) bool
- func New(filename string, typename string) plugin.Plugin
- func NewDocPlugin(filename string, typename string, isPublished bool) plugin.Plugin
- func ShouldHide(directive *ast.Directive) bool
- func StaticCheck(data *codegen.Data)
- type API
- type APIObject
- type APIParameter
- type APIRequestBody
- type APIResponse
- type APIResponseContent
- type Component
- type DocPlugin
- type Object
- type OpenAPIDoc
- type OpenAPIInfo
- type Plugin
- type ResolverBuild
- type SchemaObject
- type SchemaType
- type TypeBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSelection ¶
func IsIgnoreField ¶ added in v0.1.3
func NewDocPlugin ¶ added in v0.1.3
func ShouldHide ¶
_$_ [Using Functions Inside Go Templates - Calhoun.io](https://www.calhoun.io/intro-to-templates-p3-functions/# ) | ClippedOn=2021-08-10T09:45:06.709Z
func StaticCheck ¶ added in v0.0.21
Types ¶
type API ¶ added in v0.1.3
type API struct {
Get *APIObject `yaml:"get,omitempty"`
POST *APIObject `yaml:"post,omitempty"`
PUT *APIObject `yaml:"put,omitempty"`
Patch *APIObject `yaml:"patch,omitempty"`
Delete *APIObject `yaml:"delete,omitempty"`
// contains filtered or unexported fields
}
api请求方法
type APIObject ¶ added in v0.1.3
type APIObject struct {
OperartionID string `yaml:"operationId"`
Tags []string `yaml:"tags"`
HCIVersions []string `yaml:"x-hci-versions,omitempty"`
RequestBody *APIRequestBody `yaml:"requestBody,omitempty"`
Parameters []*APIParameter `yaml:"parameters,omitempty"`
Description string `yaml:"description,omitempty"`
Responses map[string]*APIResponse `yaml:"responses"`
}
api
type APIParameter ¶ added in v0.1.3
type APIParameter struct {
Name string `yaml:"name"`
In string `yaml:"in"`
Required bool `yaml:"required"`
Description string `yaml:"description"`
Schema *SchemaType `yaml:"schema"`
}
type APIRequestBody ¶ added in v0.1.3
type APIRequestBody struct {
Required bool `yaml:"required"`
Content *APIResponseContent `yaml:"content"`
// contains filtered or unexported fields
}
type APIResponse ¶ added in v0.1.3
type APIResponse struct {
Content *APIResponseContent `yaml:"content"`
Description string `yaml:"description"`
}
type APIResponseContent ¶ added in v0.1.3
type APIResponseContent struct {
Json *SchemaObject `yaml:"application/json"`
}
type DocPlugin ¶ added in v0.1.3
type DocPlugin struct {
// contains filtered or unexported fields
}
func (*DocPlugin) GenerateCode ¶ added in v0.1.3
func (*DocPlugin) GenerateOpenAPIDoc ¶ added in v0.1.10
func (m *DocPlugin) GenerateOpenAPIDoc(yamlDir string, schema *ast.Schema, query *codegen.Object, mutation *codegen.Object) error
GenerateOpenAPIDoc 生成openapi文档
func (*DocPlugin) MutateConfig ¶ added in v0.1.3
type Object ¶ added in v0.1.3
type Object struct {
Type string `yaml:"type"`
Format string `yaml:"format,omitempty"`
Description string `yaml:"description,omitempty"`
Enum []string `yaml:"enum,omitempty"`
Required []string `yaml:"required,omitempty"`
Properties []yaml.MapItem `yaml:"properties,omitempty"`
Minimum *float64 `yaml:"minimum,omitempty"` //Number取值限制
Maximum *float64 `yaml:"maximum,omitempty"`
OneOf []float64 `yaml:"x-oneof,omitempty"` // oneof枚举
MinLength *int64 `yaml:"minLength,omitempty"` //字符串取值限制
MaxLength *int64 `yaml:"maxLength,omitempty"`
Pattern *string `yaml:"pattern,omitempty"`
MinItems *int64 `yaml:"minItems,omitempty"` //切片元素数量限制
MaxItems *int64 `yaml:"maxItems,omitempty"`
// contains filtered or unexported fields
}
对象(包含入参、枚举、返回值)
type OpenAPIDoc ¶ added in v0.1.3
type OpenAPIDoc struct {
OpenAPI string `yaml:"openapi"`
Info *OpenAPIInfo `yaml:"info"`
Tags []string `yaml:"tags,omitempty"`
Paths map[string]*API `yaml:"paths"`
Components *Component `yaml:"components"`
}
openapi文档对象
type OpenAPIInfo ¶ added in v0.1.3
type ResolverBuild ¶
type SchemaObject ¶ added in v0.1.3
type SchemaObject struct {
Schema *SchemaType `yaml:"schema"`
}
type SchemaType ¶ added in v0.1.3
type SchemaType struct {
Type string `yaml:"type,omitempty"`
Nullable *bool `yaml:"nullable,omitempty"`
Description string `yaml:"description,omitempty"`
Format string `yaml:"format,omitempty"`
Ref string `yaml:"$ref,omitempty"`
Items *TypeBase `yaml:"items,omitempty"`
OneOf []float64 `yaml:"x-oneof,omitempty"` // oneof枚举
Minimum *float64 `yaml:"minimum,omitempty"` //Number取值限制
Maximum *float64 `yaml:"maximum,omitempty"`
MinLength *int64 `yaml:"minLength,omitempty"` //字符串取值限制
MaxLength *int64 `yaml:"maxLength,omitempty"`
Pattern *string `yaml:"pattern,omitempty"`
MinItems *int64 `yaml:"minItems,omitempty"` //切片元素数量限制
MaxItems *int64 `yaml:"maxItems,omitempty"`
// contains filtered or unexported fields
}
type TypeBase ¶ added in v0.1.3
type TypeBase struct {
Type string `yaml:"type,omitempty"`
Format string `yaml:"format,omitempty"`
Ref string `yaml:"$ref,omitempty"`
OneOf []float64 `yaml:"x-oneof,omitempty"` // oneof枚举
Minimum *float64 `yaml:"minimum,omitempty"` //Number取值限制
Maximum *float64 `yaml:"maximum,omitempty"`
MinLength *int64 `yaml:"minLength,omitempty"` //字符串取值限制
MaxLength *int64 `yaml:"maxLength,omitempty"`
Pattern *string `yaml:"pattern,omitempty"`
MinItems *int64 `yaml:"minItems,omitempty"` //切片元素数量限制
MaxItems *int64 `yaml:"maxItems,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.