notion-sdk-net icon indicating copy to clipboard operation
notion-sdk-net copied to clipboard

Change serialization of SyncFrom to NULL

Open taco-indenbosch opened this issue 5 months ago • 0 comments

I changed the serialization of the SyncFrom property from Javascript's undefined to null as required by the API. Without it new synchronized blocks cannot be created.

Description

The NullValueHandling = NullValueHandling.Include argument to the JsonProperty attribute ensures that .NET null values are serialized as Javascript null values instead of undefined. The Notion API requires the sync_from property to be null for new synced blocks.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

I am using the Notion.NET library to upload converted data to Notion. Since this change I have been able to create synced blocks, both new and linking to existing ones.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] 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
  • [x] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [x] I have checked my code and corrected any misspellings

taco-indenbosch avatar Jul 19 '25 11:07 taco-indenbosch