Skip to content

fix(data-sources): make schema round-trips writable#99

Merged
brd6 merged 1 commit into
mainfrom
fix/data-source-schema-round-trip
Jul 14, 2026
Merged

fix(data-sources): make schema round-trips writable#99
brd6 merged 1 commit into
mainfrom
fix/data-source-schema-round-trip

Conversation

@brd6

@brd6 brd6 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Description

Completes the retrieve-then-update story for data sources (the schema-level counterpart of #97):

  • DataSource::toArrayForUpdate() drops computed property configurations — created_by, created_time, last_edited_by, last_edited_time columns — which the Update Data Source API refuses ("Last edited by is not a valid property schema").
  • normalizeEmptyPropertyConfigurations() now also recognizes hydrated configuration shapes: it previously converted empty configs to {} only for hand-built single-key configs, so a retrieved date column serialized its empty config as [] and failed validation. The config key is now resolved from the type field when present.

Motivation and context

Programmatic schema editing by retrieve-modify-update — adding or renaming a column — failed on any data source with a computed or empty-config column, which is nearly all real ones.

How has this been tested?

  • New tests: computed configurations dropped from update payloads; a hydrated empty date config serializes as {} (asserted on the raw JSON) while computed columns stay filtered.
  • Verified live against the Notion API: retrieve-then-update of a real data source (computed columns plus date, select, and title) previously failed and now succeeds with the schema intact.
  • Full suite green (221 tests), plus parallel-lint, phpcs, PHPStan, and Psalm.

Builds on #98 (property names preserved in payloads); the diff shown includes it until that merges.

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.

Base automatically changed from fix/property-name-keys to main July 14, 2026 22:26
Data source update payloads carried computed property configurations —
created and edited metadata columns the API refuses to accept back —
and hydrated empty configurations serialized as arrays where the API
requires objects, because the empty-configuration normalization only
recognized hand-built single-key configs. Computed configurations are
now filtered from updates and the normalization also resolves the
config key from the type field.
@brd6
brd6 force-pushed the fix/data-source-schema-round-trip branch from 656d7cc to 3f7f863 Compare July 14, 2026 22:28
@brd6
brd6 merged commit 7f6d748 into main Jul 14, 2026
2 checks passed
@brd6
brd6 deleted the fix/data-source-schema-round-trip branch July 14, 2026 22:28
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