You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to wrap a Map<String, Any> inside a Parameters class to be used as part of a JobRequest. The goal is to deserialize dynamic JSON objects with arbitrary fields into this map and serialize them back as a flattened structure like:
{
"parameters": {
"foo": "bar",
"baz": 42
}
}
I expected to be able to achieve this by using a simple wrapper around a map, similar to Jackson's @JsonAnyGetter/@JsonAnySetter, or via Micronaut annotations such as @Serdeable, @SerdeImport, or @SerdeConfig.
Actual Behavior
Despite attempting the above approaches, I encountered either of the following:
Runtime error: No serializable introspection present for type Parameters
Or the structure is serialized with an unwanted extra layer (parameterValues) like:
Additionally, using alternatives such as JsonNode or JsonObject instead of Map<String, Any> also resulted in bean introspection errors.
Steps To Reproduce
You can reproduce this with the sample app and failing test provided here: sample application
Clone the repository and run the test to observe the error.
Environment Information
Micronaut Version: 3.10.1
Kotlin version: 1.6.21
Additional Notes
This issue is blocking for use cases where DTOs need to accept flexible, dynamic request bodies without predefining the schema, and respond with the same shape.
If possible, a mechanism similar to Jackson’s @JsonAnyGetter would be ideal for clean flattening.
The text was updated successfully, but these errors were encountered:
I tried adding implementation("io.micronaut.serde:micronaut-serde-jackson") and annotationProcessor("io.micronaut.serde:micronaut-serde-processor"), and also tried using kapt as an annotation processor, but I'm still seeing the same serialization error.
Issue description
Expected Behavior
I'm trying to wrap a
Map<String, Any>
inside aParameters
class to be used as part of aJobRequest
. The goal is to deserialize dynamic JSON objects with arbitrary fields into this map and serialize them back as a flattened structure like:I expected to be able to achieve this by using a simple wrapper around a map, similar to Jackson's
@JsonAnyGetter
/@JsonAnySetter
, or via Micronaut annotations such as@Serdeable
,@SerdeImport
, or@SerdeConfig
.Actual Behavior
Despite attempting the above approaches, I encountered either of the following:
No serializable introspection present for type Parameters
Additionally, using alternatives such as
JsonNode
orJsonObject
instead ofMap<String, Any>
also resulted in bean introspection errors.Steps To Reproduce
You can reproduce this with the sample app and failing test provided here:
sample application
Clone the repository and run the test to observe the error.
Environment Information
Additional Notes
This issue is blocking for use cases where DTOs need to accept flexible, dynamic request bodies without predefining the schema, and respond with the same shape.
If possible, a mechanism similar to Jackson’s
@JsonAnyGetter
would be ideal for clean flattening.The text was updated successfully, but these errors were encountered: