-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Issue #12486][Python Client]JsonSchema encoding is not idempotent #12490
Conversation
check keys before deleting them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might also a good idea to add a test to repro the issue, so that we're not going to break it in the future.
@merlimat That's a good point. I actually had completely overlooked the unit tests. If you'd like I can add that to this PR. I may not have time until next week however. |
I cannot get the cpp client to build, and therefore I'm not able to run the test I wrote. I couldn't build via the readme, nor could I get the docker build to succeed. I don't really have the free time currently to delve into CMake to figure out what's going on. If I had to guess based on the error message, the docker build fails probably because the docker system dependencies hasn't been kept up with the CMake dependencies for Boost Python. As for why it's failing on my machine I'm running Ubuntu 20.04 and the guide states 16.04, so maybe there's a breaking change in the version of cmake or some other tool or dependency required? |
…ent (apache#12490) * fix JsonSchema, copy data out to prevent modifying the reference object, check keys before deleting them * add unit test, but cannot test due to compilation failure for cpp lib
Fixes #12486
Motivation
JsonSchemas delete part of the Record which makes it impossible to reuse a Record. Resulting in a KeyError anytime you encode the message more than once.
Modifications
Copy on encoding the Record so modifications don't change the root object. Check keys before deleting so you don't get a KeyError.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)