Skip to content

Reference type as a default value for a field #871

Answered by MichalLytek
theseyi asked this question in Q&A
Discussion options

You must be logged in to vote

Second things - the default values.
There are two kinds:

  • GraphQL default values, which are designed to be displayed in the schema, so they should be constant (not generated uuid or current date)
  • runtime default values, when you want to have a new instance of the object (or current date) assigned to the input instance property.

Unfortunately, until #793 is resolved, dynamic default property initializers are used also as the GraphQL schema default values.
So you can't do something like on your snippet, you need to assign new values in your resolvers manually.

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@theseyi
Comment options

@smolinari
Comment options

@theseyi
Comment options

Comment options

You must be logged in to vote
4 replies
@theseyi
Comment options

@MichalLytek
Comment options

@theseyi
Comment options

@MichalLytek
Comment options

Comment options

You must be logged in to vote
1 reply
@theseyi
Comment options

Answer selected by theseyi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants