Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
twist900 committed Sep 12, 2024
1 parent e4c2704 commit 381e93f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ end
defmodule MyApp.Schema do
use Absinthe.Schema
@prototype_schema AbsintheHelpers.Directives.Constraints

directive :constraints do
on([:argument_definition, :field_definition, :input_field_definition])

arg(:min, :integer, description: "Minimum value allowed")
arg(:max, :integer, description: "Maximum value allowed")
arg(:min_items, :integer, description: "Minimum number of items allowed in a list")
arg(:max_items, :integer, description: "Maximum number of items allowed in a list")
end

query do
end

mutation do
end

# ...
end
```
Expand Down
10 changes: 10 additions & 0 deletions lib/phases/apply_constraints.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ defmodule AbsintheHelpers.Phases.ApplyConstraints do
defmodule MyApp.Schema do
use Absinthe.Schema
@prototype_schema AbsintheHelpers.Directives.Constraints
directive :constraints do
on([:argument_definition, :field_definition, :input_field_definition])
arg(:min, :integer, description: "Minimum value allowed")
arg(:max, :integer, description: "Maximum value allowed")
arg(:min_items, :integer, description: "Minimum number of items allowed in a list")
arg(:max_items, :integer, description: "Maximum number of items allowed in a list")
end
# ...
end
Expand Down

0 comments on commit 381e93f

Please sign in to comment.