poem
poem copied to clipboard
Object with serde_json::Value property doesn't show good example in UI
Expected Behavior
My API accepts arbitrary JSON:
#[derive(Object, Debug)]
pub struct BulkRequestDoc {
pub smile: String,
pub extra_data: Option<serde_json::Value>,
}
which should produce example data like:
{
"docs": [
{
"smile": "string",
"extra_data": {}
}
]
Actual Behavior
but the extra_data
field renders in the UI as:
{
"docs": [
{
"smile": "string",
"extra_data": "string"
}
]
Steps to Reproduce the Problem
- Object definition like
#[derive(Object, Debug)]
pub struct BulkRequestDoc {
pub smile: String,
pub extra_data: Option<serde_json::Value>,
}
Render web ui with
let ui = api_service.swagger_ui();
// SNIP
.nest("/", ui)
Specifications
- Version: 2.0.27
- Platform: OS X
- Subsystem: poem-openapi-derive (presumably)
I suppose I want to somehow enforce that the root value of extra_data
is a serde_json::Value::Object
. Anyone done that?