To and From annotation not serializing when overriding serde in ArangoConfiguration
mckernant1 opened this issue · 3 comments
Versions
Spring plugin: 3.2.3
Spring Dep management plugin: 1.1.4
arangodb-spring-boot-starter: 3.2-0
Code
I have sampled this out to a small repo here: https://github.com/mckernant1/arango-annotation-issue
Problem
When I override the serde method in ArangoConfiguration, and try to insert an edge with ArangoOperations.insert
@Override
public ArangoSerde serde() throws Exception {
return JacksonSerde.of(ContentType.JSON);
}
I see this error
com.arangodb.ArangoDBException: Response: 400, Error: 1233 - expecting both `_from` and `_to` attributes to be defined in the edge document and have the format `<collectionName>/<vertexKey>`
Spring Data mapping logic is implemented by ArangoConverter
. ArangoSerde
delegates the mapping to it, see:
and
You should either delegate the mapping to ArangoConverter
or implement your own mapping logic.
I see. So if you want to add jackson modules you need to redefine this object https://github.com/arangodb/spring-data/blob/main/src/main/java/com/arangodb/springframework/config/ArangoConfiguration.java#L92.
Ok Thank you
Alternatively you can register reading/writing converters from/to JsonNode
by overriding ArangoConfiguration#customConverters()
, see https://docs.arangodb.com/stable/develop/integrations/spring-data-arangodb/reference-version-4/mapping/converter/.