-
Notifications
You must be signed in to change notification settings - Fork 64
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: allow required uni-directional hasOne with @connection when datastore is disabled #888
Merged
Conversation
This file contains 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
2e74506
to
927bc7f
Compare
927bc7f
to
9932c30
Compare
palpatim
reviewed
Oct 3, 2024
it('uni-directional One:One connection with optional field and datastore is enabled', () => { | ||
const field = { ...modelMap.Session.fields[2] }; | ||
field.isNullable = true; | ||
const connectionInfo = (processConnections(field, modelMap.User, modelMap, false) as any) as CodeGenFieldConnectionBelongsTo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should dataStoreEnabled be true
here?
Suggested change
const connectionInfo = (processConnections(field, modelMap.User, modelMap, false) as any) as CodeGenFieldConnectionBelongsTo; | |
const connectionInfo = (processConnections(field, modelMap.User, modelMap, true) as any) as CodeGenFieldConnectionBelongsTo; |
palpatim
approved these changes
Oct 3, 2024
phani-srikar
approved these changes
Oct 3, 2024
This was referenced Oct 3, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes
CLI v11.0.0 introduced creating the model introspection schema at the end of every amplify push. Some customers using the v1 transformer with
@connection
with DataStore disabled were unable to upgrade to later versions of the CLI and successfully push. The model generation at the end of the push failed withDataStore does not support 1 to 1 connection with both sides of connection as optional field
. This error is not applicable to customers not using DataStore. This error would also print the case the connection was required on both sides.This change removes this restriction from customers not using DataStore.
Currently working (user is not required).
Results in following connection info.
Removing the restriction allows to set
user
as a required field.Results in the following connection info.
Codegen Paramaters Changed or Added
N/A
Issue #, if available
aws-amplify/amplify-category-api#1419
Description of how you validated changes
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.