JSTEP 8 - FasterXML/jackson-future-ideas GitHub Wiki
(Back to JSTEP page)
Refactoring of format-specific read/write features for Jackson 3
Author
Tatu Saloranta (@cowtowncoder)
Version history
- 2024-11-20: first and definitive version
Status
Work completed on 2024-11-20.
Overview
As of Jackson 2.x, format-specific features have been typically added as inner-class Enums of format-specific parsers/generators: for example, Avro module (jackson-dataformat-avro
) has:
AvroParser.Feature
for reader-side on/off featuresAvroGenerator.Feature
for writer-side on/off features
Not all formats have such features (and some only reader- or writer-side ones), but all follow the same pattern.
This was modeled based on original JsonParser.Feature
(mix of JSON-specific and general features), JsonGenerator.Feature
approach.
Jackson 2.10, however, split JsonParser.Feature
into 2 sets of Features:
StreamReadFeature
for general-purpose (cross-format, non-JSON-specific) featuresJsonReadFeature
for JSON-specific features
While there is no confusion on format-specific/general features outside of JSON package, it seems ideal to follow same naming convention, so that:
AvroParser.Feature
becomesAvroReadFeature
AvroGenerator.Feature
becomesAvroWriteFeature
Changes by component
Here are issues created for work on this JSTEP, by format module:
- Avro: dataformats-binary#522
- CBOR: dataformats-binary#524
- CSV: dataformats-text#510
- Ion: dataformats-binary#526
- Properties: No read/write features, nothing to do
- Protobuf: No read/write features, nothing to do
- Smile: dataformats-binary#528
- TOML: Already using "new style" read/write features, nothing to do
- XML: dataformat-xml#687
- YAML: dataformats-text#512