mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-19 21:03:09 +12:00
improvement: add more NonNulls
This commit is contained in:
parent
daf8513c26
commit
cacec2de1d
1 changed files with 10 additions and 3 deletions
|
@ -387,7 +387,7 @@ defmodule AshGraphql.Resource do
|
|||
%Absinthe.Blueprint.Schema.InputValueDefinition{
|
||||
name: "id",
|
||||
identifier: :id,
|
||||
type: :id,
|
||||
type: %Absinthe.Blueprint.TypeReference.NonNull{of_type: :id},
|
||||
description: "The id of the record"
|
||||
}
|
||||
]
|
||||
|
@ -642,7 +642,7 @@ defmodule AshGraphql.Resource do
|
|||
identifier: :id,
|
||||
module: schema,
|
||||
name: "id",
|
||||
type: :id
|
||||
type: %Absinthe.Blueprint.TypeReference.NonNull{of_type: :id}
|
||||
}
|
||||
|
||||
attribute ->
|
||||
|
@ -676,7 +676,14 @@ defmodule AshGraphql.Resource do
|
|||
end)
|
||||
|> Enum.map(fn
|
||||
%{cardinality: :one} = relationship ->
|
||||
type = Resource.type(relationship.destination)
|
||||
type =
|
||||
if relationship.type == :belongs_to && relationship.required? do
|
||||
%Absinthe.Blueprint.TypeReference.NonNull{
|
||||
of_type: Resource.type(relationship.destination)
|
||||
}
|
||||
else
|
||||
Resource.type(relationship.destination)
|
||||
end
|
||||
|
||||
%Absinthe.Blueprint.Schema.FieldDefinition{
|
||||
identifier: relationship.name,
|
||||
|
|
Loading…
Reference in a new issue