Is there a way to specify a default value for graphQL schema types in Amplify?
ex.
myFlag: Boolean = true
This does not compile using amplify api gql-compile
We have a flag which should default to true and would like to initialize it this way when a type is created.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Would appreciate if someone from the Amplify team could comment. Is the answer no?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
Any updates here?
+1
+1
+1
馃
Hey, I had the same problem as yours. I found this package graphql-default-value-transformer which allows us to add a default value.
I hope this will help you.
Having a @default directive for fields is quite an important feature. I hope you reconsider and add it in asap. Thank you.
+1
+1
+1
+1
+1
any update on this???
@ammarkarachi Are there any plans to add a @default
type directive or something similar?
Hi folks - i'm transferring this issue to the CLI repo and we'll be tracking this as a feature request.
It would be awesome to see @azurelogic's great work on graphql-default-value-transformer merged into the amplify
core!
@cameronbourke this is super interesting. @azurelogic - are you still maintaining that repository?
up up up
Sorry for the delayed reply. Holidays have had me busy.
Thanks @cameronbourke for connecting me to this issue!
@renebrandel, I haven't needed to do any active work on that repo since I built it this summer. That said, I'm interested in getting that merged into amplify
core. What do you need from me to move forward with that? Thanks!
Cool. As a first step, are you okay for us to recommend this as a third party plugin?
We'll do some testing on our end but would love for the folks on this thread to try it out as well.
@renebrandel Sorry, I've been swamped. I'm more than happy to have you guys recommend it as a 3rd party plugin to solve this problem.
As far as testing goes, the biggest thing that you'll want to double check is data type handling. I don't think I got a chance to put BigInt and a few others through their paces. If you find any problems, feel free to open an issue. If you have a chance to work up the solution, I'd be happy to take a PR there too. Either way, just keep me posted on next steps.
Thanks!
Most helpful comment
Would appreciate if someone from the Amplify team could comment. Is the answer no?