Hello, I am sending an update request using ashgraphql.
post.ex
...
update :update do
argument :photos, {:array, :map}, allow_nil?: true
argument :category_id, :integer, allow_nil?: true
argument :pre_diary_id, :uuid, allow_nil?: true
argument :post_diary_id, :uuid, allow_nil?: true
change management_relationship (:photo, type::direct_control)
change set_attribute(:question_answer_post_category_id, arg(:category_id), set_when_nil?: false)
change set_attribute(:pre_diary_id, arg(:pre_diary_id))
change set_attribute(:post_diary_id, arg(:post_diary_id))
end
relationships do
belongs_to :user, Dentallog.Accounts.User do
api Dentallog.Accounts
end
belongs_to :question_answer_post_category, Dentallog.QuestionAnswer.QuestionPostCategory do
allow_nil? false
attribute_writable? true
attribute_type :integer
end
belongs_to :pre_diary, Dentallog.DentalDiary.Diary do
api Dentallog.DentalDiary
end
belongs_to :post_diary, Dentallog.DentalDiary.Diary do
api Dentallog.DentalDiary
end
has_many :photos, Dentallog.QuestionAnswer.QuestionPostPhoto
has_many :comments, Dentallog.QuestionAnswer.QuestionPostComment do
filter expr(is_nil(parent_id))
end
end
Grphaql
{
"id": "899b2127-5b15-4d53-a319-6854d3e4f920",
"input": {
"title": "Edited title",
"body": "Edited body"
}
}
Response.
{
"Data": {
"updateQuestionAnswerPost": {
"errors": [
{
"message": "Required"
}
],
"Result": null
}
}
}
Here, I set the categoryId argument value to allow_nil, but when I send an update request without categoryId, I get an error saying that a required value is missing.
Do you know why?