Konventionen
...
- Unbekannte Properties führen nicht zu einem Validierungs- oder Deserialisierungs-Fehler
- Properties, deren Wert nicht definiert (null) ist, sind nicht Teil der Payload.
Beispiele
1. Unbekannte Properties
Codeblock |
---|
|
Sending POST request to http://localhost:49800/tmf622-product-order/v5/productOrder: [{
"id" : "",
"custom" : "xxx",
"category" : "Foo",
"unknown": "property",
"parties" : [ ],
"@type" : "ProductOrder"
}] |
2. JsonInclude.Include.NON_NULL
Codeblock |
---|
|
Sending POST request to http://localhost:49800/tmf622-product-order/v5/productOrder: [{
"id" : "",
"custom" : "xxx",
"category" : "Foo",
"parties" : [ ],
"@type" : "ProductOrder"
}] |
...
Codeblock |
---|
|
Sending POST request to http://localhost:49818/tmf622-product-order/v5/productOrder: [{
"id" : "",
"href" : null,
"custom" : null,
"category" : "ErrorTest",
"parties" : [ ],
"@schemaLocation" : null,
"@baseType" : null,
"@type" : "ProductOrder"
}] |
Anhang
Konfiguration des Jackson Databind ObjectMappers
ObjectMapper#disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
ObjectMapper#setSerializationInclusion(JsonInclude.Include.NON_NULL)