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

[Issue 11558][Python] Check if the record is not None #11559

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

HugoPelletier
Copy link
Contributor

Fixes #11558

Motivation

Not all sub-records are required in a schema. Taking this context into account, the code of the Record class ignored its own default values (required=False and default=None)

Modifications

The modification is a continuation of the ones made in the PR #11508.
This time only the Record class has changed. The modification affects the validation. A check of the value and the required attribute is done before validating the data type.

So if the value is empty and the required is False, the default is returned instead of raising an exception.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • *Added unit tests

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: no
  • The schema: yes
  • The default values of configurations: no
  • The wire protocol: no
  • The rest endpoints: no
  • The admin cli options: no
  • Anything that affects deployment: no

Documentation

For contributor

No documentation update is required.
The definition of the Record class wasn't respected

For committer

For this PR, do we need to update docs?

No

@codelipenghui codelipenghui added this to the 2.9.0 milestone Aug 4, 2021
@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Aug 4, 2021
@merlimat merlimat merged commit 545c95e into apache:master Aug 4, 2021
merlimat pushed a commit that referenced this pull request Aug 4, 2021
@merlimat merlimat added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Aug 4, 2021
@HugoPelletier HugoPelletier deleted the fix_python_record_none branch August 4, 2021 19:57
LeBW pushed a commit to LeBW/pulsar that referenced this pull request Aug 9, 2021
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.8.1 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Python Schema] Record can not be None
3 participants