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

Function NewActionFromObject

schema/action.go:49–58  ·  view source on GitHub ↗

NewActionFromObject create Action object from json

(id string, rawData interface{})

Source from the content-addressed store, hash-verified

47
48// NewActionFromObject create Action object from json
49func NewActionFromObject(id string, rawData interface{}) (Action, error) {
50 actionData, _ := rawData.(map[string]interface{})
51 method, _ := actionData["method"].(string)
52 path, _ := actionData["path"].(string)
53 description, _ := actionData["description"].(string)
54 inputSchema, _ := actionData["input"].(map[string]interface{})
55 outputSchema, _ := actionData["output"].(map[string]interface{})
56 parameters, _ := actionData["parameters"].(map[string]interface{})
57 return NewAction(id, method, path, description, inputSchema, outputSchema, parameters), nil
58}
59
60// TakesID checks if action takes ID as a parameter
61func (action *Action) TakesID() bool {

Callers 1

newSchemaFromObjFunction · 0.85

Calls 1

NewActionFunction · 0.85

Tested by

no test coverage detected