jackson-module-model-versioning icon indicating copy to clipboard operation
jackson-module-model-versioning copied to clipboard

Allow stateful converters

Open plilja opened this issue 4 years ago • 0 comments

Say for instance that you change your API by replacing a nested type with a reference. Then in your "pastConverter" you would probably need a database lookup. That would be easier to achieve if the converters could be stateful instead of being created new each time, like they are now.

Example: Say your API contains a Person type:

Person {
   socialSecurityNumber [String],
   firstName [String],
   lastName [String],
   address: [Address]
}

and you remove the address field and replace it with addressId. Then to be backwards compatible you would need to lookup the address from your database.

It looks like it could be achieved by allowing the VersioningModule-class to accept a list of converter instances or some kind of ConverterRepository.

plilja avatar Jul 18 '20 10:07 plilja