Created
February 6, 2025 21:46
-
-
Save austinthecoder/5fa3aecdfc0eb73e898c4bfd8b55333e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyAppWeb.Schema.NonNullNotation do | |
defmacro field!(identifier, type) do | |
quote do | |
field(unquote(identifier), non_null(unquote(type))) | |
end | |
end | |
defmacro field!(identifier, type, attrs) do | |
quote do | |
field(unquote(identifier), non_null(unquote(type)), unquote(attrs)) | |
end | |
end | |
defmacro field!(identifier, type, attrs, list) do | |
quote do | |
field(unquote(identifier), non_null(unquote(type)), unquote(attrs), unquote(list)) | |
end | |
end | |
defmacro list_of!(type) do | |
quote do | |
list_of(non_null(unquote(type))) | |
end | |
end | |
defmacro arg!(identifier, type) do | |
quote do | |
arg(unquote(identifier), non_null(unquote(type))) | |
end | |
end | |
defmacro arg!(identifier, type, attrs) do | |
quote do | |
arg(unquote(identifier), non_null(unquote(type)), unquote(attrs)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment