{"modulePath":"github.com/acoderup/goctl","version":"v1.1.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package spec\n\n## Constants\n\n```go\nconst RoutePrefixKey = \"prefix\"\n```\nRoutePrefixKey is the prefix keyword for the routes.\n\n## Variables\n\n```go\nvar ErrMissingService = errors.New(\"missing service\")\n```\n\n## Types\n\n```go\ntype Annotation struct {\n\tProperties map[string]string\n}\n```\nAnnotation defines key-value\n\n```go\ntype ApiSpec struct {\n\tInfo    Info\n\tSyntax  ApiSyntax // Deprecated: useless expression\n\tImports []Import  // Deprecated: useless expression\n\tTypes   []Type\n\tService Service\n}\n```\nApiSpec describes an api file\n\n```go\nfunc (s *ApiSpec) Validate() error\n```\nValidate validates Validate the integrity of the spec.\n\n```go\ntype ApiSyntax struct {\n\tVersion string\n\tDoc     Doc\n\tComment Doc\n}\n```\nApiSyntax describes the syntax grammar\n\n```go\ntype ArrayType struct {\n\tRawName string\n\tValue   Type\n}\n```\nArrayType describes a slice for api\n\n```go\nfunc (t ArrayType) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t ArrayType) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t ArrayType) Name() string\n```\nName returns a slice string, such as \\[]int\n\n```go\ntype AtDoc struct {\n\tProperties map[string]string\n\tText       string\n}\n```\nAtDoc describes a metadata for api grammar: @doc(...)\n\n```go\ntype DefineStruct struct {\n\tRawName string\n\tMembers []Member\n\tDocs    Doc\n}\n```\nDefineStruct describes api structure\n\n```go\nfunc (t DefineStruct) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t DefineStruct) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t DefineStruct) GetBodyMembers() []Member\n```\nGetBodyMembers returns all json fields\n\n```go\nfunc (t DefineStruct) GetFormMembers() []Member\n```\nGetFormMembers returns all form fields\n\n```go\nfunc (t DefineStruct) GetNonBodyMembers() []Member\n```\nGetNonBodyMembers returns all have no tag fields\n\n```go\nfunc (t DefineStruct) GetTagMembers(tagKey string) []Member\n```\nGetTagMembers returns all given key fields\n\n```go\nfunc (t DefineStruct) Name() string\n```\nName returns a structure string, such as User\n\n```go\ntype Doc []string\n```\nDoc describes document\n\n```go\ntype Group struct {\n\tAnnotation Annotation\n\tRoutes     []Route\n}\n```\nGroup defines a set of routing information\n\n```go\nfunc (g Group) GetAnnotation(key string) string\n```\nGetAnnotation returns the value by specified key from @server\n\n```go\ntype Import struct {\n\tValue   string\n\tDoc     Doc\n\tComment Doc\n}\n```\nImport describes api import\n\n```go\ntype Info struct {\n\t// Deprecated: use Properties instead\n\tTitle string\n\t// Deprecated: use Properties instead\n\tDesc string\n\t// Deprecated: use Properties instead\n\tVersion string\n\t// Deprecated: use Properties instead\n\tAuthor string\n\t// Deprecated: use Properties instead\n\tEmail      string\n\tProperties map[string]string\n}\n```\nInfo describes info grammar block\n\n```go\ntype InterfaceType struct {\n\tRawName string\n}\n```\nInterfaceType describes an interface for api\n\n```go\nfunc (t InterfaceType) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t InterfaceType) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t InterfaceType) Name() string\n```\nName returns an interface string, Its fixed value is any\n\n```go\ntype MapType struct {\n\tRawName string\n\t// only support the PrimitiveType\n\tKey string\n\t// it can be asserted as PrimitiveType: int、bool、\n\t// PointerType: *string、*User、\n\t// MapType: map[${PrimitiveType}]interface、\n\t// ArrayType:[]int、[]User、[]*User\n\t// InterfaceType: interface{}\n\t// Type\n\tValue Type\n}\n```\nMapType describes a map for api\n\n```go\nfunc (t MapType) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t MapType) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t MapType) Name() string\n```\nName returns a map string, such as map\\[string]int\n\n```go\ntype Member struct {\n\tName string\n\t// data type, for example, string、map[int]string、[]int64、[]*User\n\tType    Type\n\tTag     string\n\tComment string\n\t// document for the field\n\tDocs     Doc\n\tIsInline bool\n}\n```\nMember describes the field of a structure\n\n```go\nfunc (m Member) GetComment() string\n```\nGetComment returns comment value of Member\n\n```go\nfunc (m Member) GetEnumOptions() []string\n```\nGetEnumOptions return a slice contains all enumeration options\n\n```go\nfunc (m Member) GetPropertyName() (string, error)\n```\nGetPropertyName returns json tag value\n\n```go\nfunc (m Member) IsBodyMember() bool\n```\nIsBodyMember returns true if contains json tag\n\n```go\nfunc (m Member) IsFormMember() bool\n```\nIsFormMember returns true if contains form tag\n\n```go\nfunc (m Member) IsOmitEmpty() bool\n```\nIsOmitEmpty returns true if tag contains omitempty\n\n```go\nfunc (m Member) IsOptional() bool\n```\nIsOptional returns true if tag is optional\n\n```go\nfunc (m Member) IsTagMember(tagKey string) bool\n```\nIsTagMember returns true if contains given tag\n\n```go\nfunc (m Member) Tags() []*Tag\n```\nTags returns all tags in Member\n\n```go\ntype NestedStruct struct {\n\tRawName string\n\tMembers []Member\n\tDocs    Doc\n}\n```\nNestedStruct describes a structure nested in structure.\n\n```go\nfunc (t NestedStruct) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t NestedStruct) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t NestedStruct) Name() string\n```\nName returns a structure string, such as User\n\n```go\ntype PointerType struct {\n\tRawName string\n\tType    Type\n}\n```\nPointerType describes a pointer for api\n\n```go\nfunc (t PointerType) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t PointerType) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t PointerType) Name() string\n```\nName returns a pointer string, such as \\*User\n\n```go\ntype PrimitiveType struct {\n\tRawName string\n}\n```\nPrimitiveType describes the basic golang type, such as bool,int32,int64, ...\n\n```go\nfunc (t PrimitiveType) Comments() []string\n```\nComments returns the comments of struct\n\n```go\nfunc (t PrimitiveType) Documents() []string\n```\nDocuments returns the documents of struct\n\n```go\nfunc (t PrimitiveType) Name() string\n```\nName returns a basic string, such as int32,int64\n\n```go\ntype Route struct {\n\t// Deprecated: Use Service AtServer instead.\n\tAtServerAnnotation Annotation\n\tMethod             string\n\tPath               string\n\tRequestType        Type\n\tResponseType       Type\n\tDocs               Doc\n\tHandler            string\n\tAtDoc              AtDoc\n\tHandlerDoc         Doc\n\tHandlerComment     Doc\n\tDoc                Doc\n\tComment            Doc\n}\n```\nRoute describes api route\n\n```go\nfunc (r Route) GetAnnotation(key string) string\n```\nGetAnnotation returns the value by specified key from @server\n\n```go\nfunc (r Route) JoinedDoc() string\n```\nJoinedDoc joins comments and summary value in AtDoc\n\n```go\nfunc (r Route) RequestTypeName() string\n```\nRequestTypeName returns request type name of route\n\n```go\nfunc (r Route) ResponseTypeName() string\n```\nResponseTypeName returns response type name of route\n\n```go\ntype Service struct {\n\tName   string\n\tGroups []Group\n}\n```\nService describes api service\n\n```go\nfunc (s Service) JoinPrefix() Service\n```\n\n```go\nfunc (s Service) Routes() []Route\n```\nRoutes returns all routes in api service\n\n```go\ntype Tag struct {\n\t// Key is the tag key, such as json, xml, etc..\n\t// i.e: `json:\"foo,omitempty\". Here key is: \"json\"\n\tKey string\n\n\t// Name is a part of the value\n\t// i.e: `json:\"foo,omitempty\". Here name is: \"foo\"\n\tName string\n\n\t// Options is a part of the value. It contains a slice of tag options i.e:\n\t// `json:\"foo,omitempty\". Here options is: [\"omitempty\"]\n\tOptions []string\n}\n```\nTag defines a tag for structure filed\n\n```go\ntype Tags struct {\n\t// contains filtered or unexported fields\n}\n```\nTags defines a slice for Tag\n\n```go\nfunc Parse(tag string) (*Tags, error)\n```\nParse converts tag string into Tag\n\n```go\nfunc (t *Tags) Get(key string) (*Tag, error)\n```\nGet gets tag value by specified key\n\n```go\nfunc (t *Tags) Keys() []string\n```\nKeys returns all keys in Tags\n\n```go\nfunc (t *Tags) Tags() []*Tag\n```\nTags returns all tags in Tags\n\n```go\ntype Type interface {\n\tName() string\n\tComments() []string\n\tDocuments() []string\n}\n```\nType defines api type\n\n","path":"github.com/acoderup/goctl/api/spec","name":"spec","synopsis":"","isRedistributable":true}
