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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate references on belongsTo when cpk is disabled #822

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

dpilch
Copy link
Member

@dpilch dpilch commented Apr 25, 2024

Description of changes

  • validate matching references on hasOne/hasMany when processing a belongsTo when cpk is disabled
  • also pull out reference related logic from getConnectedFieldV2 and put in getConnectedFieldForReferences

Codegen Paramaters Changed or Added

N/A

Issue #, if available

Discovered by testing in with native.

Description of how you validated changes

  • Unit tests

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dpilch dpilch marked this pull request as ready for review April 25, 2024 16:20
@dpilch dpilch requested a review from a team as a code owner April 25, 2024 16:20
@dpilch dpilch changed the title fix: require custom primary key to be enabled to use references fix: validate references on belongsTo when cpk is disabled Apr 25, 2024
Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

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

Same naming nit as #818

const isUsingReferences = references.length > 0;
if (isUsingReferences) {
// ensure there is a matching hasOne/hasMany field with references
getConnectedFieldV2(field, model, otherSide, connectionDirective.name)
Copy link
Member

Choose a reason for hiding this comment

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

See naming nit from #818

phani-srikar
phani-srikar previously approved these changes Apr 25, 2024
@dpilch dpilch force-pushed the associated-field-native branch from 50cd346 to 14ee319 Compare April 25, 2024 20:27
@dpilch dpilch changed the base branch from associated-field-native to connected-field-refactor April 25, 2024 20:29
@dpilch dpilch force-pushed the cpk-references branch 3 times, most recently from 0bcf9c8 to 6ecb5bf Compare April 25, 2024 20:34
@dpilch dpilch changed the base branch from connected-field-refactor to associated-field-native April 25, 2024 20:38
@dpilch dpilch requested a review from phani-srikar April 25, 2024 20:39
palpatim
palpatim previously approved these changes Apr 26, 2024
Base automatically changed from associated-field-native to main April 26, 2024 13:59
@palpatim palpatim dismissed stale reviews from phani-srikar and themself April 26, 2024 13:59

The base branch was changed.

atierian
atierian previously approved these changes Apr 26, 2024
@dpilch dpilch enabled auto-merge (squash) April 26, 2024 14:14
@dpilch dpilch merged commit a909ff3 into main Apr 26, 2024
3 of 4 checks passed
@dpilch dpilch deleted the cpk-references branch June 4, 2024 16:57
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.

4 participants