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

Allow @key to reference non-required fields #336

Open
wizage opened this issue Mar 17, 2020 · 2 comments
Open

Allow @key to reference non-required fields #336

wizage opened this issue Mar 17, 2020 · 2 comments
Labels

Comments

@wizage
Copy link

wizage commented Mar 17, 2020

Describe the bug
Today @key doesn't allow you to reference non-mandatory fields. This can hinder other transforms and custom revolvers that might take a null field and fill in a default if no value is given.

Amplify CLI Version
4.16.1

To Reproduce
An example:

type Answer @model @key(fields: ["owner", "gameID"])
@auth(
    rules: [
        {allow: owner, ownerField: "owner"}
    ]
)
{
    owner: String
    gameID: ID!
    answer: [Int]
}

This example, fails to compile today but should compile as the resolver will auto fill the owner field in if no value is provide due to the auth resolver.

Expected behavior
I expect a flag to be able to set in the @key transform that will allow me to disable the required non-nullable check. Or this should not stop the compile and should throw a warning letting me know that there could be possible issues down the road but will allow me to still push.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: v12.13.1
@RossWilliams
Copy link

See duplicate aws-amplify/amplify-cli#3275

@wizage
Copy link
Author

wizage commented Mar 18, 2020

See duplicate aws-amplify/amplify-cli#3275

I would disagree but it does look like it does relate/might be a duplicate of aws-amplify/amplify-cli#1657

@edwardfoyle edwardfoyle removed their assignment Apr 9, 2020
@siegerts siegerts added the feature-request New feature or request label Sep 3, 2021
@alharris-at alharris-at transferred this issue from aws-amplify/amplify-cli May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants