Skip to content

Commit

Permalink
ExampleValue for a silce is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
zl03jsj committed Jan 4, 2022
1 parent 9b11c4b commit 4172a3c
Show file tree
Hide file tree
Showing 8 changed files with 3,725 additions and 309 deletions.
4 changes: 3 additions & 1 deletion api/docgen/docgen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package docgen

import (
"encoding/json"
"fmt"
"go/ast"
"go/parser"
Expand Down Expand Up @@ -252,6 +253,7 @@ func init() {
addExample(map[abi.SectorNumber]string{
123: "can't acquire read lock",
})
addExample(json.RawMessage(`"json raw message"`))
addExample(map[api.SectorState]int{
api.SectorState(sealing.Proving): 120,
})
Expand Down Expand Up @@ -348,7 +350,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} {
switch t.Kind() {
case reflect.Slice:
out := reflect.New(t).Elem()
reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
out = reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
return out.Interface()
case reflect.Chan:
return ExampleValue(method, t.Elem(), nil)
Expand Down
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
Loading

0 comments on commit 4172a3c

Please sign in to comment.