tsoa
tsoa copied to clipboard
@ExampleRequestBody to to used like @Example for response
Sorting
-
I'm submitting a ...
- [ ] bug report
- [x] feature request
- [ ] support request
-
I confirm that I
- [x] used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
@ExampleRquestBody<MyEndpointRequestBody>({
"type": "a",
"aProp": false
})
@ExampleRquestBody<MyEndpointRequestBody>({
"type": "b",
"bProp": true
})
@ExampleRquestBody<MyEndpointRequestBody>({
"type": "c",
"cProp": false
})
@Post('my-endpoint')
public async myEndpint(
@Body() body: MyEndpointRequestBody,
@Request() request: Request,
).... blar blar blar
Current Behavior
not possible to add example requests, only on response. which isn't helpful here.
Possible Solution
see expected
Steps to Reproduce
n/a
Context (Environment)
n/a
Detailed Description
@ExampleRequestBody to to used like @Example for response
Breaking change?
n/a
#180 requests this, and then after much confusion, it was closed, and asked to make a new issue, and as far as I can tell, it was never created.. so I have added it now..
The combination of @param
and @example
jsdoc tags already covers this use case, yes? As described in this comment on #180
Nope, not even close.
for me it seems to work, if the example is written all in the same line
e.g.
@example body { "features": [ { "geometry": { "coordinates": [ [ [ 0 ] ] ], "type": "Polygon" }, "properties": { "value": 0 }, "type": "Feature" } ], "type": "FeatureCollection" }
works,
@example body {
"features": [
{
"geometry":
{
"coordinates":
[
[
[
0
]
]
],
"type": "Polygon"
},
"properties": {
"value": 0
},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
does not
@WORMSS I think you should remove the two empty checkboxes. These seem to generate that progress indicator which says that two of four tasks have been finished. This suggests that this issue is actively being worked on while it is not, judging from the activity in this thread.
@slavistan once you have changed the text in .github/ folder, I would be happy too.