JSON returns json format of schema
()
| 621 | |
| 622 | //JSON returns json format of schema |
| 623 | func (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 |
| 650 | func (schema *Schema) GetLockingPolicy(event string) LockPolicy { |
no outgoing calls
no test coverage detected