Skip to content

fix: support Notion icon object payload deserialization#66

Merged
brd6 merged 3 commits into
mainfrom
feat/notion-icon-object-deserialization
Mar 25, 2026
Merged

fix: support Notion icon object payload deserialization#66
brd6 merged 3 commits into
mainfrom
feat/notion-icon-object-deserialization

Conversation

@brd6
Copy link
Copy Markdown
Owner

@brd6 brd6 commented Mar 25, 2026

Description

  • add Resource\File\Icon and Resource\Property\IconProperty so payloads with icon.type = "icon" are deserialized instead of throwing UnsupportedFileTypeException
  • preserve structured icon fields (name, color) and expose a helper URL builder (getUrl(mode)) for native Notion icon rendering
  • add regression and round-trip serialization tests for endpoint/resource hydration paths

Motivation and context

Notion now returns native icon payloads shaped like:
{"icon": {"type": "icon", "icon": {"name": "book", "color": "gray"}}}.
The SDK previously had no File\Icon mapping, which caused downstream sync failures during page hydration from databases()->query().

How has this been tested?

  • ./vendor/bin/phpunit (108 tests, 691 assertions)
  • focused regression paths:
    • tests/Endpoint/DatabasesEndpointTest.php::testQueryDatabaseWithIconObject
    • tests/Resource/PageTest.php::testPageWithIconObject
    • tests/Resource/DatabaseTest.php::testDatabaseWithIconObject
    • tests/Resource/DataSourceTest.php::testDataSourceWithIconObject
    • tests/Resource/File/IconTest.php and tests/Resource/Property/IconPropertyTest.php (including toArray() round-trip)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

@brd6 brd6 merged commit 123c396 into main Mar 25, 2026
21 checks passed
@brd6 brd6 deleted the feat/notion-icon-object-deserialization branch March 25, 2026 11:33
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