34 lines
630 B
Plaintext
34 lines
630 B
Plaintext
type Node {
|
|
Name string `json:"name" binding:"min=1"`
|
|
Children []Node `json:"children" binding:"max=100"`
|
|
Next *Node `json:"next,omitempty"`
|
|
Lookup map[string]Node `json:"lookup,omitempty"`
|
|
}
|
|
|
|
type Branch {
|
|
Leaf *Leaf `json:"leaf"`
|
|
}
|
|
|
|
type Leaf {
|
|
Branch *Branch `json:"branch"`
|
|
}
|
|
|
|
@server (group: trees)
|
|
service recursive-example {
|
|
@handler tree
|
|
get /tree returns (Node)
|
|
|
|
@handler forest
|
|
get /forest returns ([]Node)
|
|
|
|
@handler optional
|
|
get /optional returns (*Node)
|
|
|
|
@handler raw
|
|
@response raw
|
|
get /raw returns (Node)
|
|
|
|
@handler pair
|
|
get /pair returns (Branch)
|
|
}
|