Skip to content

Commit

Permalink
Fix sending null attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
stantanasi committed Dec 8, 2021
1 parent 0673245 commit af06eb2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class JsonApiRequestConverter : Converter<Any, RequestBody> {
when {
it.param.hasAnnotation<JsonApiAttribute>() -> {
val annotation = it.param.findAnnotation<JsonApiAttribute>()!!
attributes.put(annotation.name, propValue)
attributes.put(annotation.name, propValue ?: JSONObject.NULL)
}
it.param.hasAnnotation<JsonApiRelationship>() -> {
val annotation = it.param.findAnnotation<JsonApiRelationship>()!!
Expand All @@ -83,7 +83,7 @@ class JsonApiRequestConverter : Converter<Any, RequestBody> {
}
else -> when {
it.prop.isJsonApiAttribute() -> {
attributes.put(it.prop.name, it.prop.call(value))
attributes.put(it.prop.name, it.prop.call(value) ?: JSONObject.NULL)
}
it.prop.isJsonApiRelationship() -> {
relationships.put(it.prop.name,
Expand Down

0 comments on commit af06eb2

Please sign in to comment.