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

Use JSONDecodingOptions.ignoreUnknownFields to ignore unknown enums. #1345

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

thomasvl
Copy link
Collaborator

A new conformance test came in protocolbuffers/protobuf@09f4901 that says ignoreUnknownFields should also result in unknown enums being ignored.

These changes are based on #896.

Fixes #972.

@tbkka
Copy link
Contributor

tbkka commented Nov 15, 2022

Nice work! I think we might be missing a couple of test cases, but the core logic looks sound.

A new conformance test came in protocolbuffers/protobuf@09f4901 that says
ignoreUnknownFields should also result in unknown enums being ignored.

These changes are based on apple#896.

Fixes apple#972.
@tbkka
Copy link
Contributor

tbkka commented Nov 15, 2022

Thank you for adding those. Looks all ready to go!

@thomasvl thomasvl merged commit 41684a8 into apple:main Nov 15, 2022
@thomasvl thomasvl deleted the unknown_enums_json branch November 15, 2022 21:09
@antongrbin antongrbin mentioned this pull request Jan 5, 2023
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this pull request Mar 26, 2024
…wn_fields is set (#15887)

# Motivation

This PR fixes failing conformance tests for python with name `IgnoreUnknownEnumStringValue`.

The JSON parsing spec was discussed in #7392.

Recent equivalent changes for other languages:
* Swift: apple/swift-protobuf#1345
* C#: #15758

# Changes

- 1st commit is a noop  refactoring to make relevant _ConvertScalarFieldValue invocations localized
- 2nd commit introduces the child exception of `ParseError` named `EnumStringValueParseError` which is suppressed if `ignore_unknown_fields` is set
- 3rd commit updates the conformance test failure lists

Closes #15887

COPYBARA_INTEGRATE_REVIEW=#15887 from noom:anton/7392/fix-python-test fbcc93a
PiperOrigin-RevId: 619288323
elvisdukaj pushed a commit to elvisdukaj/protobuf that referenced this pull request Apr 3, 2024
…wn_fields is set (protocolbuffers#15887)

# Motivation

This PR fixes failing conformance tests for python with name `IgnoreUnknownEnumStringValue`.

The JSON parsing spec was discussed in protocolbuffers#7392.

Recent equivalent changes for other languages:
* Swift: apple/swift-protobuf#1345
* C#: protocolbuffers#15758

# Changes

- 1st commit is a noop  refactoring to make relevant _ConvertScalarFieldValue invocations localized
- 2nd commit introduces the child exception of `ParseError` named `EnumStringValueParseError` which is suppressed if `ignore_unknown_fields` is set
- 3rd commit updates the conformance test failure lists

Closes protocolbuffers#15887

COPYBARA_INTEGRATE_REVIEW=protocolbuffers#15887 from noom:anton/7392/fix-python-test fbcc93a
PiperOrigin-RevId: 619288323
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.

Issue parsing unknown enum case
2 participants