Documentation
¶
Index ¶
- Variables
- func AutoDiscover() []string
- func CallableName(e *Entry) string
- func Groups(entryType EntryType) []string
- func LoadYAML(data []byte) error
- func Register(entry *Entry)
- func Reset()
- func Stats() map[EntryType]*StatInfo
- type DocFile
- type Endpoint
- type Entry
- type EntryType
- type ListOption
- type Method
- type StatInfo
- type TypeValue
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
var DynamicIDGroups = map[string]bool{ "models": true, "schemas": true, "stores": true, "fs": true, "tasks": true, "schedules": true, }
DynamicIDGroups lists groups whose process.make() uses group.<id>.method addressing. The handler key in process.Handlers is "group.method" (without <id>), but users call them as "group.<id>.method".
Exported so that CLI layers can build the callable pattern for display.
Functions ¶
func AutoDiscover ¶
func AutoDiscover() []string
AutoDiscover compares process.Handlers with registered doc entries and returns a sorted list of handler names that have no documentation.
func CallableName ¶
CallableName returns the user-facing callable pattern for a process entry. For dynamic-ID groups (models, schemas, stores, fs, tasks, schedules) the handler key is "group.method" but users call "group.<id>.method", so this function returns "models.<id>.find". For all other groups it returns the entry name as-is.
func LoadYAML ¶
LoadYAML unmarshals embedded YAML data and registers all entries. Process entry names are normalised to match the handler key stored in process.Handlers (gou/process/process.go RegisterGroup):
group="models", name="find" → "models.find" (handler key) group="http", name="get" → "http.get" (handler key) group="encoding", name="encoding.base64.Encode" → unchanged
Types ¶
type DocFile ¶
type DocFile struct {
Group string `yaml:"group"`
Type EntryType `yaml:"type"`
Entries []Entry `yaml:"entries"`
}
DocFile is the top-level structure of a doc.yml file.
type Endpoint ¶
type Endpoint struct {
Method string `json:"method" yaml:"method"`
Path string `json:"path" yaml:"path"`
Guard string `json:"guard,omitempty" yaml:"guard,omitempty"`
}
Endpoint describes an HTTP API endpoint (reserved for OpenAPI).
type Entry ¶
type Entry struct {
Name string `json:"name" yaml:"name"`
Type EntryType `json:"type" yaml:"type"`
Group string `json:"group" yaml:"group"`
Desc string `json:"desc" yaml:"desc"`
Args []TypeValue `json:"args,omitempty" yaml:"args,omitempty"`
Return *TypeValue `json:"return,omitempty" yaml:"return,omitempty"`
Methods []Method `json:"methods,omitempty" yaml:"methods,omitempty"`
Endpoint *Endpoint `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
}
Entry is a single documentation item.
func Get ¶
Get retrieves a single entry by type and name (case-insensitive). For process entries it also resolves callable names like "models.user.find" to the handler key "models.find".
func List ¶
func List(entryType EntryType, opts ...ListOption) []*Entry
List returns entries of the given type, optionally filtered.
type ListOption ¶
ListOption controls filtering for List calls.
type Method ¶
type Method struct {
Name string `json:"name" yaml:"name"`
Desc string `json:"desc" yaml:"desc"`
Args []TypeValue `json:"args,omitempty" yaml:"args,omitempty"`
Return *TypeValue `json:"return,omitempty" yaml:"return,omitempty"`
}
Method describes a method on a JS object or class.
type StatInfo ¶
type StatInfo struct {
Total int `json:"total"`
Documented int `json:"documented"`
Undocumented int `json:"undocumented"`
}
StatInfo holds documentation coverage statistics for one EntryType.
type TypeValue ¶
type TypeValue struct {
Type string `json:"type" yaml:"type"`
Desc string `json:"desc,omitempty" yaml:"desc,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Fields []TypeValue `json:"fields,omitempty" yaml:"fields,omitempty"`
Items *TypeValue `json:"items,omitempty" yaml:"items,omitempty"`
Variants []TypeValue `json:"variants,omitempty" yaml:"variants,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
}
TypeValue is the universal value descriptor used for arguments, return values, fields and method signatures. Its Type field follows the bridge.go Go↔JS mapping:
Base: null, undefined, bool, number, bigint, string, object, array,
bytes, error, function, promise, external
Extended: void, any, union
Named: Response, Paginated, CodeBlock, … (object with fields)
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Status string `json:"status"`
Name string `json:"name"`
Suggestion []string `json:"suggestion,omitempty"`
Message string `json:"message"`
Entry *Entry `json:"entry,omitempty"`
}
ValidationResult holds the outcome of a Validate call.
func Validate ¶
func Validate(entryType EntryType, name string) *ValidationResult
Validate checks whether a named entry of the given type is documented. For process entries it also resolves callable names like "models.user.find" to their handler key "models.find" (stripping the dynamic <id> segment).