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(datastore): add required fields in selection set for hasOne-belongsTo relationship #3476

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thisisabhash
Copy link
Member

Issue #

#3259

Description

This PR adds the required fields(recursively) for an associated model connected to a model with @belongsTo and @hasone directive.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

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

@@ -53,7 +53,7 @@ extension SelectionSet {
let schema = ModelRegistry.modelSchema(from: associatedModelName) {
if recursive {
var recursive = recursive
if field._isBelongsToOrHasOne {
if field._isBelongsToOrHasOne && !field.isRequired {
Copy link
Contributor

Choose a reason for hiding this comment

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

even though it's a minor fix, is there a unit test that can be updated or added to cover this change?

Base automatically changed from 5d/partial-sync to fix/gh-3259 January 19, 2024 00:34
Base automatically changed from fix/gh-3259 to main January 22, 2024 22:10
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.

3 participants