Skip to content

Codec Options Reference

Complete reference for all load/save options across core codec, format-specific settings, and REST client overrides. For architecture and configuration resolution rules see docs/codec-v2-spec/02-config-resolution.md. For end-to-end tabular format examples see docs/tabular-exporter-examples.md.


Table of contents


Configuration model

Options are resolved from six sources in descending priority. Higher-priority sources win at every key they specify; unset keys fall through to the next level.

PrioritySource
1 (highest)Load / save options map (per-operation)
2Resource config
3ResourceFactory defaults
4CodecModule config (global)
5EAnnotation on the model element
6 (lowest)Built-in defaults

Options also have a scope: Global, EClass, or Feature. A feature-scoped value is the most specific and overrides the global value for that feature alone. Runtime-only options (root type hint, value reader instances, etc.) exist only in the load/save map — they cannot be set via EAnnotations.

Both the short key (e.g. serializeNull) and the prefixed key (e.g. codec.serializeNull) are accepted in the options map. EAnnotation details always use the short key. The CodecOptions constants use the prefixed form and are the recommended way to pass options in code.


Core options

These options apply to every format. Java constants are in org.eclipse.fennec.codec.constants.CodecOptions.

Type strategy

Option keyConstantTypeDefaultDescription
codec.typeStrategyCODEC_TYPE_STRATEGYStringURIHow type info is written/read. Values: URI, NAME, CLASS, SCHEMA_AND_TYPE, NUMERIC, NONE.
codec.typeKeyCODEC_TYPE_KEYString_typeJSON property name for the type discriminator field.
codec.typeFormatCODEC_TYPE_FORMATStringPLAINPLAIN writes a bare string; STRUCTURED writes {"type":"…","schema":"…"}.
codec.typeIncludeCODEC_TYPE_INCLUDEBooleantrueSet false to suppress the type field entirely.
codec.typeNameKeyCODEC_TYPE_NAME_KEYStringtypeInner key for the class name in STRUCTURED format.
codec.typeSchemaKeyCODEC_TYPE_SCHEMA_KEYStringschemaInner key for the schema URI in STRUCTURED format.
codec.typeScopeCODEC_TYPE_SCOPEStringALLLimit where the type strategy is applied. Values: ALL, SUBTYPE_ONLY.
codec.smartCompressionCODEC_SMART_COMPRESSIONBooleanfalseOmit _type when the concrete type is unambiguous from context (containment reference with a single possible EClass).
codec.fingerprintModeCODEC_FINGERPRINT_MODEStringNONEWrite the in-band EPackage fingerprint. NONE writes none; FIRST_TOUCH writes it at the first occurrence of each package instance. Reading is always liberal and independent of this option.
codec.fingerprintKeyCODEC_FINGERPRINT_KEYStringfingerprintKey carrying the fingerprint (PLAIN sibling: _fingerprint). The only way to tell a reader about a non-default key — annotations configure it for writing only.

ID strategy

Option keyConstantTypeDefaultDescription
codec.idStrategyCODEC_ID_STRATEGYStringID_FIELDHow the identity key is written. Values: ID_FIELD (EID attribute), COMBINED (multiple features joined), NONE.
codec.idKeyCODEC_ID_KEYString_idJSON property name for the generated ID field.
codec.idKeyModeCODEC_ID_KEY_MODEStringID_ONLYControls which key names appear. Values: ID_ONLY, FEATURE_ONLY, BOTH, NONE.
codec.idFormatCODEC_ID_FORMATStringPLAINPLAIN writes a bare value; STRUCTURED wraps it in an object.
codec.idOnTopCODEC_ID_ON_TOPBooleanfalseWrite the ID field before the type field.
codec.idFeaturesCODEC_ID_FEATURESList<String>Feature names to concatenate for COMBINED strategy.
codec.idSeparatorCODEC_ID_SEPARATORString-Separator between parts in COMBINED strategy.

Reference

Option keyConstantTypeDefaultDescription
codec.refFormatCODEC_REF_FORMATStringPLAINPLAIN writes a bare URI string; STRUCTURED wraps it in {"$ref":"…"} (with optional _type).
codec.refKeyCODEC_REF_KEYString$refKey for the reference URI inside a STRUCTURED object.
codec.refTypeKeyCODEC_REF_TYPE_KEYString_typeKey for the type hint inside a STRUCTURED reference object.
codec.expandCODEC_EXPANDBooleanfalseInline (expand) non-containment referenced objects instead of emitting a $ref.
codec.expandDepthCODEC_EXPAND_DEPTHInteger1Maximum depth for recursive expansion.
codec.expandIgnoreBidirectionalCODEC_EXPAND_IGNORE_BIDIRECTIONALBooleantrueSkip the back-pointer side of bidirectional references during expansion.

Feature & visibility

Option keyConstantTypeDefaultDescription
codec.serializeNullCODEC_SERIALIZE_NULLBooleanfalseWrite features whose value is null.
codec.serializeEmptyCODEC_SERIALIZE_EMPTYBooleanfalseWrite many-valued features that are empty collections.
codec.serializeDefaultsCODEC_SERIALIZE_DEFAULTSBooleanfalseWrite features whose value equals the EAttribute default.
codec.enumSerializationCODEC_ENUM_SERIALIZATIONStringLITERALHow enum values are written. Values: LITERAL (name string), VALUE (integer ordinal), NAME (EMF name).
codec.dateFormatCODEC_DATE_FORMATStringISO 8601SimpleDateFormat pattern for java.util.Date attributes. Null = ISO 8601 fallback.
codec.fieldOrderCODEC_FIELD_ORDERStringDECLARATIONColumn/field ordering for tabular formats. Values: DECLARATION, ALPHABETICAL.
codec.keyCODEC_KEYStringfeature nameOverride the JSON property name for a specific feature (annotation or per-feature scope only).
codec.transientCODEC_TRANSIENTBooleanfalseMark a feature as not serialized/deserialized.

SuperType

Option keyConstantTypeDefaultDescription
codec.superTypeSerializeCODEC_SUPERTYPE_SERIALIZEBooleanfalseInclude supertype information as a dedicated field.
codec.superTypeKeyCODEC_SUPERTYPE_KEYString_superTypesJSON key for the supertype field.
codec.superTypeStrategyCODEC_SUPERTYPE_STRATEGYStringALLWhich supertypes to include. Values: ALL, ALL_EMF, SINGLE, NONE.
codec.superTypeAsArrayCODEC_SUPERTYPE_AS_ARRAYBooleantrueWrite supertypes as a JSON array. false writes a separator-delimited string.

Global

Option keyConstantTypeDefaultDescription
codec.typeMapIdCODEC_TYPE_MAP_IDStringID of the discriminator mapping registry to use for type resolution.
codec.fallbackStrategyCODEC_FALLBACK_STRATEGYStringSKIPWhat to do when a discriminator value cannot be resolved. Values: SKIP, FALLBACK, ERROR.
codec.deserializationModeCODEC_DESERIALIZATION_MODEStringLENIENTType-resolution failure handling. STRICT throws; LENIENT records a warning and continues.
codec.throwOnValidationWarningsCODEC_THROW_ON_VALIDATION_WARNINGSBooleanfalseTurn validation warnings (e.g. URI/option mismatch) into exceptions.
codec.maxPayloadSizeCODEC_MAX_PAYLOAD_SIZELong104857600Maximum bytes read from an input stream (100 MB default). Protects against DoS via oversized payloads.

Runtime (load/save only)

These keys are valid only in the per-operation options map. They cannot be set via EAnnotations or CodecModule config.

Option keyConstantTypeDescription
codec.rootTypeCODEC_ROOT_TYPEEClass or URI StringType hint for the root object during load. Required when the JSON has no _type field and the type cannot be inferred.
codec.rootSchemaCODEC_ROOT_SCHEMAString (nsURI) or EPackageEPackage namespace URI (or EPackage instance) used as context for NAME strategy type resolution. The instance form is multi-version-safe.
codec.rootFingerprintCODEC_ROOT_FINGERPRINTString (fingerprint)Optional. Package model fingerprint selecting the version a String root type/schema resolves against under same-nsURI multi-version. Unknown or conflicting fingerprint → error (both modes).
codec.featureTypeHintsCODEC_FEATURE_TYPE_HINTSMap<String, EClass>Per-feature type hints keyed by feature name.
codec.featureValueReaderInstancesCODEC_FEATURE_VALUE_READER_INSTANCESMap<EStructuralFeature, CodecValueReader>Bind reader instances directly to features (bypasses the registry). Works for EAttributes and EReferences.
codec.featureValueWriterInstancesCODEC_FEATURE_VALUE_WRITER_INSTANCESMap<EStructuralFeature, CodecValueWriter>Bind writer instances directly to features (bypasses the registry). Works for EAttributes and EReferences.
codec.featureValueReadersCODEC_FEATURE_VALUE_READERSMap<EStructuralFeature, String>Deprecated — bind registered readers via "ClassName.featureName"valueReaderName instead. Attributes only; ignored for references.
codec.featureValueWritersCODEC_FEATURE_VALUE_WRITERSMap<EStructuralFeature, String>Deprecated — bind registered writers via "ClassName.featureName"valueWriterName instead. Attributes only; ignored for references.
codec.eClassConfigCODEC_ECLASS_CONFIGMap<EClass, Map>Per-EClass option overrides applied at the EClass scope level.
codec.eReferenceConfigCODEC_EREFERENCE_CONFIGMap<EReference, Map>Per-EReference option overrides.
codec.eAttributeConfigCODEC_EATTRIBUTE_CONFIGMap<EAttribute, Map>Per-EAttribute option overrides.

Not supported — runtime registry registration: there is no option to register readers/writers into the CodecValueRegistry per load/save operation. In particular, a reader/writer that a model annotation (valueReaderName/valueWriterName) refers to cannot be supplied at load time — it must be in the registry when the resource is created (factory, OSGi service, or programmatic registration). For ad-hoc cases bind an instance per feature with codec.featureValueReaderInstances/...WriterInstances. The former codec.valueReaders/codec.valueWriters options were never functional and have been removed (issue #45).


Format options

Each format accepts all core options plus the format-specific keys listed below.

JSON

Bundle: org.eclipse.fennec.codec · Extension: .json · Content-Type: application/json

JSON is the default format. It uses the native Jackson path and does not define any format-specific option keys — all behaviour is controlled by the core options above. Pretty-printing is not currently exposed as a save option.


BSON

Bundle: org.eclipse.fennec.codec.bson · Extension: .bson · Content-Type: application/bson

BSON has no load/save option keys of its own. The only BSON-specific tuning is the maximum payload size, which is set at construction time on BsonFormatProvider and cannot be changed per-operation:

java
// 50 MB limit instead of the default 100 MB
BsonFormatProvider provider = new BsonFormatProvider(50L * 1024 * 1024);

BSON does not support array-root resources (supportsArrayRoot() returns false); a resource with more than one root object cannot be serialized to BSON.


CBOR

Bundle: org.eclipse.fennec.codec.cbor · Extension: .cbor · Content-Type: application/cbor

CBOR is a compact binary JSON superset handled by Jackson's CBOR data format. No format-specific option keys are defined — all core options apply unchanged.


YAML

Bundle: org.eclipse.fennec.codec.yaml · Extensions: .yaml, .yml · Content-Types: application/yaml, text/yaml

YAML output is produced via Jackson's YAML data format. No format-specific option keys are defined — all core options apply unchanged.


CSV

Bundle: org.eclipse.fennec.codec.csv · Extensions: .csv, .csvz · Constants: CodecCsvOptions

The .csv extension defaults to IGNORE reference mode (single flat file). The .csvz extension defaults to SQL_TABLES (ZIP of CSVs, one per EClass). See also Tabular shared below.

Option keyConstantTypeDefaultRESTDescription
codec.csv.delimiterOPTION_DELIMITERchar / String,Column separator character.
codec.csv.quoteModeOPTION_QUOTE_MODEStringREQUIREDWhen to quote fields. Values: REQUIRED, ALWAYS, NON_EMPTY, EMPTY.
codec.csv.lineEndingOPTION_LINE_ENDINGStringLFRow terminator. Values: LF, CR, CRLF, PLATFORM.
codec.csv.charsetOPTION_CHARSETStringUTF-8Character encoding for the output file.
codec.csv.dataTypeInSecondRowOPTION_DATA_TYPE_IN_SECOND_ROWBooleantrueEmit the SQL-type row (e.g. VARCHAR, INTEGER) as the second row after the header. Set false to output header + data only.

ODS

Bundle: org.eclipse.fennec.codec.ods · Extension: .ods · Constants: CodecOdsOptions

OpenDocument Spreadsheet. Cells carry native types. FK cells in SQL_TABLES mode become clickable hyperlinks by default (requires the vendored sods fork with LinkedValue support). The sods writer stores the FK id as the link's display text, making the cell a string; set OPTION_GENERATE_LINKS = false to keep FK cells numeric. See also Tabular shared below.

Option keyConstantTypeDefaultRESTDescription
codec.ods.styleHeaderOPTION_STYLE_HEADERBooleantrueApply bold + grey background to the header row.
codec.ods.adjustColumnWidthOPTION_ADJUST_COLUMN_WIDTHBooleantrueAuto-fit column widths to content.
codec.ods.generateLinksOPTION_GENERATE_LINKSBooleantrueRender FK cells as clickable hyperlinks to the target sheet in SQL_TABLES mode.

XLSX

Bundle: org.eclipse.fennec.codec.xlsx · Extension: .xlsx · Constants: CodecXlsxOptions

Microsoft Excel via Apache POI. Sheet names are auto-truncated to 31 characters with collision suffixes. FK hyperlinks keep the cell value numeric (unlike ODS). See also Tabular shared below.

Option keyConstantTypeDefaultRESTDescription
codec.xlsx.styleHeaderOPTION_STYLE_HEADERBooleantrueApply bold + grey background to the header row.
codec.xlsx.adjustColumnWidthOPTION_ADJUST_COLUMN_WIDTHBooleantrueAuto-fit column widths to content.
codec.xlsx.freezeHeaderRowOPTION_FREEZE_HEADER_ROWBooleantrueFreeze the first (header) row when scrolling.
codec.xlsx.generateLinksOPTION_GENERATE_LINKSBooleantrueRender FK cells as hyperlinks to the target sheet in SQL_TABLES mode.
codec.xlsx.defaultDateFormatOPTION_DEFAULT_DATE_FORMATStringm/d/yy h:mmExcel number format pattern applied to date cells.

R Language (.RData)

Bundle: org.eclipse.fennec.codec.rlang · Extensions: .RData, .rdataz · Constants: CodecRLangOptions

Binary R serialization. Each table becomes a typed data frame (INTSXP, REALSXP, LGLSXP, STRSXP, native POSIXct for dates). See also Tabular shared below.

Option keyConstantTypeDefaultRESTDescription
codec.rlang.dataframePerFileOPTION_DATAFRAME_PER_FILEBooleanfalseWrite one .RData per data frame inside a ZIP archive (.rdataz). Auto-set to true when the URI ends in .rdataz.

Tabular shared

Bundle: org.eclipse.fennec.codec.tabular · Applies to: CSV, ODS, XLSX, R Language · Constants: CodecTabularOptions

Option keyConstantTypeDefaultRESTDescription
codec.tabular.referenceModeOPTION_REFERENCE_MODEStringformat-dependent¹How object relationships are rendered. Values: IGNORE (attributes only), FLAT (dotted column names), SQL_TABLES (one table per EClass with FK columns).
codec.tabular.fkColumnSuffixOPTION_FK_COLUMN_SUFFIXString_idSuffix appended to FK column names in SQL_TABLES mode.
codec.tabular.schemasOPTION_SCHEMASMap<EClass|EPackage, String>Schema name prefix per EClass or EPackage. Drives subdirectory (ZIP), sheet-name prefix (ODS/XLSX), or variable-name prefix (R).
codec.tabular.columnTypesOPTION_COLUMN_TYPESMap<EStructuralFeature, String>Override the SQL type string for specific features (e.g. "DECIMAL(15,2)").
codec.tabular.multiValuedRefStrategyOPTION_MULTI_VALUED_REF_STRATEGYStringPREFER_FK_COLUMNHow multi-valued non-containment references are represented. Values: PREFER_FK_COLUMN, ALWAYS_JOIN_TABLE.

¹ Default reference mode: IGNORE for .csv, .ods, .xlsx, .RData; SQL_TABLES for .csvz, .rdataz.


JSON Schema

Bundle: org.eclipse.fennec.codec.jsonschema · Content-Type: application/schema+json · Constants: CodecJsonSchemaOptions

JSON Schema uses its own option namespace (codec.jsonschema.*). Options are passed through EffectiveCodecConfig.getCustomProperties() — any codec.* key that does not match a known ConfigProperty is automatically collected there.

Option keyConstantTypeDefaultDescription
codec.jsonschema.draftOPTION_SCHEMA_DRAFTString2020-12JSON Schema draft version. Values: draft-04, draft-06, draft-07, 2019-09, 2020-12.
codec.jsonschema.pretty.printOPTION_PRETTY_PRINTBooleanfalsePretty-print the JSON Schema output.
codec.jsonschema.allFieldsRequiredOPTION_ALL_FIELDS_REQUIREDBooleanfalseMark every property as required. Useful for AI structured-output schemas.
codec.jsonschema.flatAllOfOPTION_FLAT_ALL_OFBooleanfalseFlatten allOf inheritance into a single object definition.
codec.jsonschema.useAnchorRefsOPTION_USE_ANCHOR_REFSBooleanfalseUse $anchor identifiers instead of JSON Pointer $ref paths.
codec.jsonschema.inlineRefsOPTION_INLINE_REFSBooleanfalseReplace all $ref uses with inlined definitions. Omits $defs. Cycle guard emits {"type":"object"} for recursive types.
codec.jsonschema.useNamesFromExtendedMetadataOPTION_USE_NAMES_FROM_EXTENDED_METADATABooleanfalseUse ExtendedMetaData annotation names for properties instead of feature names.
codec.jsonschema.suppressKeywordsOPTION_SUPPRESS_KEYWORDSCollection<String>Suppress specific JSON Schema keywords from output (e.g. maxItems, description, additionalProperties). Useful for API validators that reject certain keywords.
codec.jsonschema.suppressVendorExtensionsOPTION_SUPPRESS_VENDOR_EXTENSIONSBooleanfalseOmit x-abstract, x-interface, and x-containment vendor extensions from output.
codec.jsonschema.useAnyOfForAbstractOPTION_USE_ANY_OF_FOR_ABSTRACTBooleanfalseUse anyOf instead of oneOf for abstract type discriminators.
codec.jsonschema.generateOclConstraintsOPTION_GENERATE_OCL_CONSTRAINTSBooleanfalseLoad option. Compile JSON Schema assertion keywords (minLength, maxLength, pattern, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, uniqueItems) and format (uuid/email) into OCL invariants on the generated EClasses, using EMF's standard validation-delegate annotation convention (validationDelegates / constraints / delegate-URI-sourced expression details). See docs/OCL-Constraint-Generation-Implementation-Plan.md.
codec.jsonschema.oclDelegateUriOPTION_OCL_DELEGATE_URIStringhttp://www.eclipse.org/emf/2002/Ecore/OCL/PivotLoad option. The EMF validation-delegate URI generated invariants are registered under. Only relevant when OPTION_GENERATE_OCL_CONSTRAINTS is enabled. Any URI works as long as a matching EValidator.ValidationDelegate is registered at runtime (Eclipse OCL, its Pivot dialect, or a third-party engine). fennec-codec has no compile/runtime dependency on any OCL engine — it only writes the annotations.

REST client-overridable options

A REST client can override a controlled subset of options per request by sending the Codec-Options HTTP header with comma-separated key=value pairs:

POST /export
Accept: text/csv
Codec-Options: codec.tabular.referenceMode=SQL_TABLES, codec.csv.dataTypeInSecondRow=false

The ClientCodecOptionsFilter in codec.rest collects whitelists from all registered RestOverridableCodecOptions services, drops any non-whitelisted keys, parses values by declared type, and merges the result into the save/load options map. Client values win over annotation-based options.

Key format: core options use their short ConfigProperty key (e.g. serializeNull), while format-specific options use their full prefixed key (e.g. codec.csv.delimiter). Non-whitelisted keys are silently ignored.

Security: options with high blast-radius — expand, expandDepth, typeStrategy, value reader/writer names — are deliberately excluded from all whitelists. To expose a new key, implement RestOverridableCodecOptions in the owning bundle and register it as an OSGi DS component. See docs/codec-rest-client-overridable-options.md for the full design.

Core — CoreOverridableCodecOptions

Applies to all formats.

Header keyTypeValues
serializeNullBooleantrue / false
serializeEmptyBooleantrue / false
serializeDefaultBooleantrue / false
enumSerializationStringLITERAL, VALUE, NAME
fieldOrderStringDECLARATION, ALPHABETICAL
idOnTopBooleantrue / false
dateFormatStringAny SimpleDateFormat pattern, e.g. yyyy-MM-dd

CSV — CsvOverridableCodecOptions

Includes all core options above, plus:

Header keyTypeValues
codec.tabular.referenceModeStringIGNORE, FLAT, SQL_TABLES
codec.csv.dataTypeInSecondRowBooleantrue / false
codec.csv.delimiterStringSingle character, e.g. ; or ,
codec.csv.quoteModeStringREQUIRED, ALWAYS, NON_EMPTY, EMPTY
codec.csv.lineEndingStringLF, CR, CRLF, PLATFORM
codec.csv.charsetStringCharset name, e.g. UTF-8, ISO-8859-1

ODS — OdsOverridableCodecOptions

Includes all core options above, plus:

Header keyTypeValues
codec.tabular.referenceModeStringIGNORE, FLAT, SQL_TABLES
codec.ods.styleHeaderBooleantrue / false
codec.ods.adjustColumnWidthBooleantrue / false
codec.ods.generateLinksBooleantrue / false

XLSX — XlsxOverridableCodecOptions

Includes all core options above, plus:

Header keyTypeValues
codec.tabular.referenceModeStringIGNORE, FLAT, SQL_TABLES
codec.xlsx.styleHeaderBooleantrue / false
codec.xlsx.adjustColumnWidthBooleantrue / false
codec.xlsx.freezeHeaderRowBooleantrue / false
codec.xlsx.generateLinksBooleantrue / false
codec.xlsx.defaultDateFormatStringExcel number format pattern, e.g. yyyy-MM-dd

R Language — RLangOverridableCodecOptions

Includes all core options above, plus:

Header keyTypeValues
codec.tabular.referenceModeStringIGNORE, FLAT, SQL_TABLES
codec.rlang.dataframePerFileBooleantrue / false

Released under the EPL-2.0 License. Eclipse Fennec is part of the Eclipse Foundation.