toedter / spring-hateoas-jsonapi

A JSON:API media type implementation for Spring HATEOAS
Apache License 2.0
106 stars 15 forks source link

JsonApiData#164 remove id and type field property if entity has a property named "type" #53

Closed gaoyang-projects closed 2 years ago

gaoyang-projects commented 2 years ago

use case: @JsonApiTypeForClass(value = "data") DataEntity { private Long id; private String type; // int, long, bool }

if entity has a property named "type",JsonApiData remove it from "attributes", output result: { "data": { "id": "123", "type": "data", "attributes": { // "type":"int" should be here } } } JsonApiData#164 Map<String, Object> attributeMap = objectMapper.convertValue(content, Map.class); attributeMap.remove("links"); attributeMap.remove(idField.name); attributeMap.remove(typeField.name);

toedter commented 2 years ago

Sorry for not reacting faster, I was on vacation. I'll take a look at it.

toedter commented 2 years ago

fixed in the latest snapshot, will be in the next release.