shyan
AEAsh Elixir
•Created by shyan on 7/14/2023 in #support
How to make fields optional for graphql api?
For posterity: I ended up using the specific result type of my query, rather than the generic type of the resulting resource, which was churned out by graphql-codgen. The optionality of the field I had in mind was supported by the specific result type, thereby solving my problem.
10 replies
AEAsh Elixir
•Created by shyan on 7/14/2023 in #support
How to make fields optional for graphql api?
Yeah, I think you're right. Apologies, I went barking up the wrong tree hah
10 replies
AEAsh Elixir
•Created by shyan on 7/14/2023 in #support
How to make fields optional for graphql api?
I am automatically generating types for my typescript react app using
graphql-codegen
based on the graphql schema. If I don't query for that particular field, my result is mismatched with the type it corresponds to, because the type wants to make sure the field is on the result. I guess what I really want to do is figure out a way for the graphql schema that's automatically generated to say, hey, it's ok not to include this field. Hopefully that makes more sense? Apologies, probably not doing the best job of expressing what I want.10 replies
AEAsh Elixir
•Created by shyan on 6/26/2023 in #support
Ash Graphql "create" mutation with upsert? true – how to use ID as argument for upsert identity?
Rad thank you Zach, I'm going to try it out
5 replies
AEAsh Elixir
•Created by shyan on 6/26/2023 in #support
Ash Graphql "create" mutation with upsert? true – how to use ID as argument for upsert identity?
And to clarify – if the
id
is provided and does not match an existing record – I want that to result in an error. If the id
is not provided at all, I want that to result in a "create". And if the id
is provided and does match an existing record, I want that to result in an "update". What's the recommended way of going about doing this? I initially had two separate mutations for two separate actions (create
and update
) but when I saw upsert? true
was an option – I wanted to take advantage of it.5 replies