Skip to content

feat: Add support for dynamic fields on models and endpoints - #5013

Merged
marcelomendoncasoares merged 10 commits into
serverpod:mainfrom
marcelomendoncasoares:dynamic-serialization
May 1, 2026
Merged

marcelomendoncasoares merged 10 commits into
serverpod:mainfrom
marcelomendoncasoares:dynamic-serialization

Conversation

@marcelomendoncasoares

Copy link
Copy Markdown
Collaborator

Implements the support for dynamic fields in models and endpoints.

Under the hood, it uses the same strategy that we apply for streaming endpoints to encode the value as a Map<String, dynamic>. with the type on the className key.

On the database, the value is stored in a ColumnSerializable or ColumnStructured column - according to the JSON/JSONB serialization data type.

Closes: #4996
Closes: #3231

Related discussions:

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

None.

@marcelomendoncasoares
marcelomendoncasoares marked this pull request as ready for review April 28, 2026 21:45
@marcelomendoncasoares
marcelomendoncasoares requested a review from a team April 28, 2026 21:45

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nielsenko
nielsenko self-requested a review May 1, 2026 07:44

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits.. and a potential problem

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@marcelomendoncasoares
marcelomendoncasoares merged commit 63460ce into serverpod:main May 1, 2026
81 checks passed
@marcelomendoncasoares
marcelomendoncasoares deleted the dynamic-serialization branch May 1, 2026 15:15
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asymmetric handling of Map<String, dynamic>: serialization works, deserialization throws Map<String, dynamic> as an Endpoint Parameter

2 participants