Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphic CSV Reading and Writing #80

Open
JKerwood opened this issue Apr 24, 2018 · 2 comments
Open

Polymorphic CSV Reading and Writing #80

JKerwood opened this issue Apr 24, 2018 · 2 comments
Labels

Comments

@JKerwood
Copy link

Can the CSV mapper handle polymorphic reading and writing. If it can could you show a quick example?

@cowtowncoder
Copy link
Member

If you have concrete suggestion for additional functionality (or even a general idea), yes, feel free to add here.
At this point polymorphic handling is not really supported.

If this is more of a question (or start of discussion), please use mailing list:

https://groups.google.com/group/jackson-user/

as issue tracker is not meant as discussion or support forum.

@stevenleadbeater
Copy link

I've hit this issue recently in work. I used your CsvSchema classes to speculatively detect polymorphic array members already... Then found that the csv itself wouldn't deserialize because the JsonParser attached to the CsvMapper has only a single CsvSchema attached. I can apply the same concepts I used for the validation here to inspect the JsonTypeInfo data and swap out the CsvSchema on the JsonParser based on the type field. It's a bit of an overhaul as there's a few ways to apply the polymorphic typing with Jackson but I'm going to have a crack at this and try get a PR in for you. Also, I may separately extend the column types to allow validating types a bit more accurate, ie. Distinguish between decimals and integers and potentially do a bit of date detection. Polymorphism first though. Are you guys open to PRs? I should be able to keep the performance impact as close to negligible as possible. It could be zero'd out if I make polymorphic handling a DeserializationFeature that has to be turned on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants