Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(orm): use naming strategy for computed field #970

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

RomainLanz
Copy link
Member

@RomainLanz RomainLanz commented Oct 18, 2023

WARNING
This is a breaking change that must be documented.
To keep the previous behavior, users must manually set the name using the serializeAs option.

 class User extends BaseModel {
   @computed({ serializeAs: 'fullName' })
   declare fullName: string
 }

Hey! 馃憢馃徎

This PR changes the way computed field works.

Beforehand, the computed field serialization wasn't using the naming strategy. Making the output inconsistent.
After this PR, the computed field will be serialized using the naming strategy (same as column field).

@RomainLanz
Copy link
Member Author

Breaking tests are related to https://github.com/adonisjs/road-to-v6/discussions/41

@thetutlage
Copy link
Member

Can you rebase with the latest commit? That way the breaking tests should pass

@RomainLanz
Copy link
Member Author

Done 馃憤馃徎

@thetutlage thetutlage merged commit 073fee4 into v6-next Dec 15, 2023
31 of 32 checks passed
@thetutlage thetutlage deleted the refactor/computed branch December 15, 2023 03:50
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.

None yet

2 participants