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

Allow setting Status property value to null #426

Closed
wants to merge 1 commit into from

Conversation

mzahor
Copy link

@mzahor mzahor commented Jan 10, 2025

Description

WARNING: Not sure what is the correct target branch. This is the fix for 4.2.0, based on 4.2.0 tag in git.

In Notion API, in order to clear status property value to whatever is default, you can send null and it works same way as with Select:

{
    "properties": {
        "Status": {"status": null}
    }
}

Currently, in version 4.2.0 which is the latest published version, this prop is not serialized when null, leading to misleading validation errors from notion api, which may look like this:

body failed validation. Fix one:
body.properties.YwcW.title should be defined, instead was `undefined`.
body.properties.YwcW.rich_text should be defined, instead was `undefined`.
body.properties.YwcW.number should be defined, instead was `undefined`.
body.properties.YwcW.url should be defined, instead was `undefined`.
body.properties.YwcW.select should be defined, instead was `undefined`.
body.properties.YwcW.multi_select should be defined, instead was `undefined`.
body.properties.YwcW.people should be defined, instead was `undefined`.
body.properties.YwcW.email should be defined, instead was `undefined`.
body.properties.YwcW.phone_number should be defined, instead was `undefined`.
body.properties.YwcW.date should be defined, instead was `undefined`.
body.properties.YwcW.checkbox should be defined, instead was `undefined`.
body.properties.YwcW.relation should be defined, instead was `undefined`.
body.properties.YwcW.files should be defined, instead was `undefined`.
body.properties.YwcW.status should be defined, instead was `undefined`.
body.properties.YwcW.id should be defined, instead was `undefined`.
body.properties.YwcW.name should be defined, instead was `undefined`.
body.properties.YwcW.start should be defined, instead was `undefined`.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested manually and ran unit tests

  • Reading multiple pages with props of different types (including status)
  • Reading multiple pages with props of different types (including status, null and non-null)
  • Running unit tests

Test Configuration:

  • SDK: 8.0.401

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@mzahor
Copy link
Author

mzahor commented Jan 13, 2025

fixed this and other columns in #427

@mzahor mzahor closed this Jan 13, 2025
@mzahor mzahor deleted the fix/status-prop-null branch January 13, 2025 11:03
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.

1 participant