A port of a cheat sheet authored by Hafiz Ismail.
defmodule MyApp.Schema do
use Absinthe.Schema
interface :entity do
field :id, :id #ID! ?
field :name, :string
end
scalar
object :user do
interface :user
field :id, :id
field :name, :string
field :age, :int
field :balance, :float
field :is_active, :boolean
field :friends, list_of(:user)
field :website, :url
end
query do
# ...
end
mutation do
# ...
end
end
:int |
Int |
:float |
Float |
:string |
String |
:boolean |
Boolean |
:id |
ID |
scalar |
Salar Type |
object |
Object Type |
field |
Object Type |
interface |
Interface Type |
union |
Union Type |
enum |
Enum Type |
input_object |
Input Object Type |
:string |
Nullable String type |
non_null(:string) |
Non-nullable String type |
list_of(:string) |
List of nullable Strings type |
non_null(list_of(:string)) |
Non-null list of nullable Strings type |
non_null(list_of(non_null(:string))) |
Non-null list of non-null Strings type |
Basic Input Input with default value Input with multiple argument Input with multiple arguments and default values
input_object :list_users_input do
field :list, :int
field :since_id, :id
end
# ????
scalar :url
object :user {
field :name, :string
field :homepage, :url
}
Object implementing one or more Interfaces
Union of one or more Objects
Uh oh!
There was an error while loading. Please reload this page.