jackson-dataformats-text icon indicating copy to clipboard operation
jackson-dataformats-text copied to clipboard

Add `.ignoreProperty()` to csv builder

Open membersound opened this issue 2 years ago • 4 comments

I would love to add fieldnames that should be ignored, like:

mapper.schemaFor(ExternalEntity.class).withHeader().ignoreProperty('id');

I know the @JsonIgnore annotation, but that requires modifying the target class, which is not always possible. Thus, a configuration setter would be required.

membersound avatar Feb 20 '23 10:02 membersound

While I can see why it might be convenient, conceptually this is bit different from what CsvSchema is meant to define: mapping of column positions to logical name, type.

Still, I can see how some variation would perhaps make sense... would just need to think of how it maps nice to the model. I guess the idea is that definition of ignoral would essentially "hide" column value so that Databind would not see key/value pair at all.

cowtowncoder avatar Feb 21 '23 04:02 cowtowncoder

Hi,

I have raised a PR for this issue: https://github.com/FasterXML/jackson-dataformats-text/pull/418

Can you please review and suggest?

djay-S avatar May 01 '23 15:05 djay-S

@membersound Can you check out #418 to see if that does what you want? It seems to me that it wouldn't (does something bit different) but I would like to know for sure.

cowtowncoder avatar Jul 28 '23 03:07 cowtowncoder

@cowtowncoder Can you have a look at my changes for #418.

djay-S avatar Aug 05 '23 17:08 djay-S