mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 05:13:33 +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{
|
%Absinthe.Blueprint.Schema.InputValueDefinition{
|
||||||
name: "id",
|
name: "id",
|
||||||
identifier: :id,
|
identifier: :id,
|
||||||
type: :id,
|
type: %Absinthe.Blueprint.TypeReference.NonNull{of_type: :id},
|
||||||
description: "The id of the record"
|
description: "The id of the record"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -642,7 +642,7 @@ defmodule AshGraphql.Resource do
|
||||||
identifier: :id,
|
identifier: :id,
|
||||||
module: schema,
|
module: schema,
|
||||||
name: "id",
|
name: "id",
|
||||||
type: :id
|
type: %Absinthe.Blueprint.TypeReference.NonNull{of_type: :id}
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute ->
|
attribute ->
|
||||||
|
@ -676,7 +676,14 @@ defmodule AshGraphql.Resource do
|
||||||
end)
|
end)
|
||||||
|> Enum.map(fn
|
|> Enum.map(fn
|
||||||
%{cardinality: :one} = relationship ->
|
%{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{
|
%Absinthe.Blueprint.Schema.FieldDefinition{
|
||||||
identifier: relationship.name,
|
identifier: relationship.name,
|
||||||
|
|
Loading…
Reference in a new issue