MCPcopy Create free account
hub / github.com/cloudwan/gohan / JSON

Method JSON

schema/schema.go:623–647  ·  view source on GitHub ↗

JSON returns json format of schema

()

Source from the content-addressed store, hash-verified

621
622//JSON returns json format of schema
623func (schema *Schema) JSON() map[string]interface{} {
624 actions := map[string]interface{}{}
625 for _, a := range schema.Actions {
626 actions[a.ID] = map[string]interface{}{
627 "method": a.Method,
628 "path": a.Path,
629 "input": a.InputSchema,
630 "output": a.OutputSchema,
631 }
632 }
633 return map[string]interface{}{
634 "id": schema.ID,
635 "plural": schema.Plural,
636 "title": schema.Title,
637 "description": schema.Description,
638 "parent": schema.Parent,
639 "singular": schema.Singular,
640 "prefix": schema.Prefix,
641 "url": schema.URL,
642 "namespace": schema.NamespaceID,
643 "schema": schema.JSONSchema,
644 "actions": actions,
645 "metadata": schema.Metadata,
646 }
647}
648
649// GetLockingPolicy gets locking policy for given schema and event
650func (schema *Schema) GetLockingPolicy(event string) LockPolicy {

Callers 3

gohanGenerateFunction · 0.80
GetSchemaFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected