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

Denote every field which is omitted when None. #106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EliRibble
Copy link

There are some fields that can be sent with null values over JSON, which means they are set to None within Python. The broad config-based exclude directive is not given any information about the field, only it's value, so we can't use it to determine if a field should be excluded or not in the dict that gets built.

Instead we create a helper function to build a field definition that has the necessary exclude function. Any field that does not use this helper function is permitted to be None/null. This is true of the MailboxGet.ids field in this commit. A new test is added to maintain the behavior over time.

Resolves #105

There are some fields that can be sent with `null` values over JSON, which
means they are set to `None` within Python. The broad config-based exclude
directive is not given any information about the field, only it's value, so
we can't use it to determine if a field should be excluded or not in the dict
that gets built.

Instead we create a helper function to build a field definition that has the
necessary exclude function. Any field that does not use this helper function
is permitted to be None/null. This is true of the MailboxGet.ids field in this
commit. A new test is added to maintain the behavior over time.
smkent added a commit that referenced this pull request Jul 9, 2024
Applied updates from upstream project template commits:

smkent/cookie-python@ef0eb85...9404738

*   9404738 Merge pull request #106 from smkent/manage
|\
| * c3a564f Add get_branch() to mock repo response in manage unit tests
| * b4dd69d Add html_url to mock repo response in manage unit tests
| * ae30c7c Improve GitHub API/repo interactions in manage-cookie
* |   36c238b Merge pull request #105 from smkent/manage-cookie
|\ \
| |/
|/|
| * b0dc20f Update project template cruft, dependencies
|/
*   9cedf76 Merge pull request #104 from smkent/actions
|\
| * c85a1a5 Add CODECOV_TOKEN to codecov action in CI workflow
| * 6624aeb Update Github action versions
|/
*   9e52fa1 Merge pull request #103 from smkent/manage-cookie
|\
| * 36078ed Update dependencies
|/
*   9313b3e Merge pull request #102 from smkent/temp-cache-dir
|\
| * 4f47bdc Use temp dir for Poetry cache directory in manage-cookie
|/
*   95be994 Merge pull request #101 from smkent/manage-cookie
|\
| * 22e3bcf Apply automatic linting fixes
| * 4faeb9b Update dependencies
|/
* b7ed95d Merge pull request #100 from smkent/manage-cookie
* 97c1031 Update project template cruft, dependencies

Updated project dependencies via `poetry update`:

Package operations: 1 install, 29 updates, 1 removal

- Removing setuptools (69.1.1)
- Updating certifi (2024.2.2 -> 2024.7.4)
- Updating idna (3.6 -> 3.7)
- Updating pygments (2.17.2 -> 2.18.0)
- Updating types-python-dateutil (2.8.19.20240106 -> 2.9.0.20240316)
- Updating urllib3 (2.2.1 -> 2.2.2)
- Updating filelock (3.13.1 -> 3.15.4)
- Updating jinja2 (3.1.3 -> 3.1.4)
- Updating platformdirs (4.2.0 -> 4.2.2)
- Updating pluggy (1.4.0 -> 1.5.0)
- Updating requests (2.31.0 -> 2.32.3)
- Updating typing-extensions (4.10.0 -> 4.12.2)
- Updating packaging (23.2 -> 24.1)
- Installing shellingham (1.5.4)
- Updating coverage (7.4.3 -> 7.5.4)
- Updating gitpython (3.1.42 -> 3.1.43)
- Updating identify (2.5.35 -> 2.6.0)
- Updating nodeenv (1.8.0 -> 1.9.1)
- Updating typer (0.9.0 -> 0.12.3)
- Updating marshmallow (3.21.1 -> 3.21.3)
- Updating pytest (8.0.2 -> 8.2.2)
- Updating virtualenv (20.25.1 -> 20.26.3)
- Updating bandit (1.7.7 -> 1.7.9)
- Updating black (24.2.0 -> 24.4.2)
- Updating dataclasses-json (0.6.4 -> 0.6.7)
- Updating mypy (1.8.0 -> 1.10.1)
- Updating pep8-naming (0.13.3 -> 0.14.1)
- Updating poethepoet (0.25.0 -> 0.27.0)
- Updating pytest-cov (4.1.0 -> 5.0.0)
- Updating responses (0.25.0 -> 0.25.3)
- Updating types-requests (2.31.0.20240218 -> 2.32.0.20240622)

Writing lock file
smkent added a commit that referenced this pull request Jul 9, 2024
Applied updates from upstream project template commits:

smkent/cookie-python@ef0eb85...dee411e

*   dee411e Merge pull request #107 from smkent/poetry
|\
| * 42c4a3b Update Poetry to version 1.8 in CI workflows
* |   8831a68 Merge pull request #108 from smkent/manage
|\ \
| |/
|/|
| * 296f6b5 Fix CODECOV_TOKEN reference rendering in template CI workflow
|/
*   9404738 Merge pull request #106 from smkent/manage
|\
| * c3a564f Add get_branch() to mock repo response in manage unit tests
| * b4dd69d Add html_url to mock repo response in manage unit tests
| * ae30c7c Improve GitHub API/repo interactions in manage-cookie
* |   36c238b Merge pull request #105 from smkent/manage-cookie
|\ \
| |/
|/|
| * b0dc20f Update project template cruft, dependencies
|/
*   9cedf76 Merge pull request #104 from smkent/actions
|\
| * c85a1a5 Add CODECOV_TOKEN to codecov action in CI workflow
| * 6624aeb Update Github action versions
|/
*   9e52fa1 Merge pull request #103 from smkent/manage-cookie
|\
| * 36078ed Update dependencies
|/
*   9313b3e Merge pull request #102 from smkent/temp-cache-dir
|\
| * 4f47bdc Use temp dir for Poetry cache directory in manage-cookie
|/
*   95be994 Merge pull request #101 from smkent/manage-cookie
|\
| * 22e3bcf Apply automatic linting fixes
| * 4faeb9b Update dependencies
|/
* b7ed95d Merge pull request #100 from smkent/manage-cookie
* 97c1031 Update project template cruft, dependencies

Updated project dependencies via `poetry update`:

Package operations: 1 install, 29 updates, 1 removal

- Removing setuptools (69.1.1)
- Updating certifi (2024.2.2 -> 2024.7.4)
- Updating idna (3.6 -> 3.7)
- Updating pygments (2.17.2 -> 2.18.0)
- Updating types-python-dateutil (2.8.19.20240106 -> 2.9.0.20240316)
- Updating urllib3 (2.2.1 -> 2.2.2)
- Updating filelock (3.13.1 -> 3.15.4)
- Updating jinja2 (3.1.3 -> 3.1.4)
- Updating packaging (23.2 -> 24.1)
- Updating pluggy (1.4.0 -> 1.5.0)
- Installing shellingham (1.5.4)
- Updating platformdirs (4.2.0 -> 4.2.2)
- Updating requests (2.31.0 -> 2.32.3)
- Updating typing-extensions (4.10.0 -> 4.12.2)
- Updating coverage (7.4.3 -> 7.5.4)
- Updating gitpython (3.1.42 -> 3.1.43)
- Updating identify (2.5.35 -> 2.6.0)
- Updating marshmallow (3.21.1 -> 3.21.3)
- Updating nodeenv (1.8.0 -> 1.9.1)
- Updating pytest (8.0.2 -> 8.2.2)
- Updating typer (0.9.0 -> 0.12.3)
- Updating virtualenv (20.25.1 -> 20.26.3)
- Updating bandit (1.7.7 -> 1.7.9)
- Updating black (24.2.0 -> 24.4.2)
- Updating dataclasses-json (0.6.4 -> 0.6.7)
- Updating mypy (1.8.0 -> 1.10.1)
- Updating pep8-naming (0.13.3 -> 0.14.1)
- Updating poethepoet (0.25.0 -> 0.27.0)
- Updating pytest-cov (4.1.0 -> 5.0.0)
- Updating responses (0.25.0 -> 0.25.3)
- Updating types-requests (2.31.0.20240218 -> 2.32.0.20240622)

Writing lock file
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.

Permit sending null values
1 participant