danielgtaylor / danielgtaylor/huma
Is there a simpler solution to add an example to the requestBody?
- Dominant language
- Go
- Stars
- 4.4k
- Forks
- 285
- Avg merge
- 40m
- Merged PRs (30d)
- 1
Description
My current solution is as follows:
```golang
var (
createTaskExample = utils.MustUnmarshalJSON[map[string]any](`
{
"payload": {
},
"priority": 0
}
`)
)
huma.Operation{
Tags: []string{enums.OpenAPITagManagement.String()},
OperationID: "createTask",
Method: http.MethodPost,
Path: "/tasks/create",
Summary: "create task",
RequestBody: &huma.RequestBody{
Content: map[string]*huma.MediaType{
"application/json": {
Example: createTaskExample,
},
},
},
}
```
Is there a simpler solution to add an example to the requestBody?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.