Repository navigation
refactor: Separate ClassDefinition into specialization classes. - #3270
Merged
Merged
Conversation
…delClassDefinition.
SandPod
force-pushed
the
separate-model-definitions
branch
from
February 26, 2025 11:38
1594e68 to
7a2c70f
Compare
SandPod
force-pushed
the
separate-model-definitions
branch
from
February 26, 2025 13:16
7a2c70f to
1328f13
Compare
SandPod
force-pushed
the
separate-model-definitions
branch
from
February 26, 2025 13:39
1328f13 to
004c7ac
Compare
SandPod
marked this pull request as ready for review
February 26, 2025 13:53
christerswahn
left a comment
Contributor
There was a problem hiding this comment.
Good stuff and easy to grasp overview in the PR description! Just had a question for discussion!
SandPod
force-pushed
the
separate-model-definitions
branch
from
February 28, 2025 05:39
fea5d35 to
8360fe1
Compare
SandPod
force-pushed
the
separate-model-definitions
branch
from
February 28, 2025 05:46
8360fe1 to
dc12564
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR lays the groundwork for introducing interfaces by defining explicit types for parsed model structures.
Key changes:
ModelClassDefinitionandExceptionClassDefinitionwere both represented asClassDefinition, distinguished only by a boolean flag.The inheritance structure allows us to target parse rules for specific definitions while sharing logic for all definitions that have fields.
New inheritance structure
The new inheritance structure looks like this:
It will now be simple to add an
InterfaceClassDefintionwhile preserving all the validation rules that already apply toClassDefinitionfields.Open question
There is an argument for renaming
ClassDefinitiontoModelDefinitionand then having the specializations communicate what type of model definition we have so we would have the following structure:The new inheritance structure looks like this:
Guidance for review
Best reviewed commit by commit.
A new test was added at the end for a specific case that I encountered that was not previously covered.
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
None - These changes here are intended to be a strictly internal refactor.