ExampleValue for a silce is nil

This commit is contained in:
zl 2021-12-28 10:38:12 +08:00
parent 9b11c4b319
commit 4172a3c8b7
8 changed files with 3721 additions and 305 deletions

View File

@ -1,6 +1,7 @@
package docgen
import (
"encoding/json"
"fmt"
"go/ast"
"go/parser"
@ -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,
})
@ -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)

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -103,7 +103,9 @@ Response:
"MemSwap": 42,
"MemSwapUsed": 42,
"CPUs": 42,
"GPUs": null,
"GPUs": [
"string value"
],
"Resources": {
"seal/v0/addpiece": {
"0": {
@ -691,7 +693,18 @@ Perms: admin
Inputs: `null`
Response: `null`
Response:
```json
[
{
"ID": "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8",
"Weight": 42,
"LocalPath": "string value",
"CanSeal": true,
"CanStore": true
}
]
```
### Remove
Storage / Other
@ -749,7 +762,9 @@ Inputs:
},
"ProofType": 8
},
null,
[
1024
],
1024,
{}
]
@ -784,7 +799,12 @@ Inputs:
},
"ProofType": 8
},
null
[
{
"Offset": 1024,
"Size": 1024
}
]
]
```
@ -946,7 +966,9 @@ Inputs:
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
null
[
"Ynl0ZSBhcnJheQ=="
]
]
```
@ -979,7 +1001,12 @@ Inputs:
},
"ProofType": 8
},
null
[
{
"Offset": 1024,
"Size": 1024
}
]
]
```
@ -1012,7 +1039,14 @@ Inputs:
},
"ProofType": 8
},
null
[
{
"Size": 1032,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
]
]
```
@ -1045,9 +1079,16 @@ Inputs:
},
"ProofType": 8
},
null,
null,
null,
"Bw==",
"Bw==",
[
{
"Size": 1032,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
],
{
"Unsealed": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
@ -1085,7 +1126,7 @@ Inputs:
},
"ProofType": 8
},
null
"Bw=="
]
```
@ -1115,8 +1156,15 @@ Inputs:
},
"ProofType": 8
},
null,
null
"Bw==",
[
{
"Size": 1032,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
]
]
```
@ -1146,7 +1194,7 @@ Inputs:
},
"ProofType": 8
},
null
"Bw=="
]
```
@ -1263,7 +1311,7 @@ Inputs:
},
1040384,
1024,
null,
"Bw==",
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff