Skip to content

Add Protobuf read feature for unknown enum default fallback - #814

Open
Dongnyoung wants to merge 2 commits into
FasterXML:3.xfrom
Dongnyoung:issue-398-protobuf-unknown-enum-default
Open

Dongnyoung wants to merge 2 commits into
FasterXML:3.xfrom
Dongnyoung:issue-398-protobuf-unknown-enum-default

Conversation

@Dongnyoung

Copy link
Copy Markdown
Contributor

Fixes #398

Adds ProtobufReadFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE to allow unknown enum numeric values to fall back to the Protobuf schema-level default enum value (the first declared enum constant).

The feature is disabled by default, preserving existing behavior.

For standard enums, fallback preserves the existing VALUE_NUMBER_INT token representation. For non-standard enums, it preserves VALUE_STRING by using the first declared enum name.

The fallback is handled at the Protobuf parser level and does not depend on databind's EnumFeature or @JsonEnumDefaultValue.

Tests cover both standard and non-standard enums, including non-standard enums whose first declared numeric value is not 0.

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Coverage Type Coverage Change
📝 Instructions 78.13% 📈 +0.09%
🔀 Branches 70.38% 📈 +0.29%

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Honor READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE feature with Protobuf

1 participant