Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit d70272d

Browse files
author
Josh Price
committed
Update readme with new style schema
1 parent 87a8ecd commit d70272d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ Allows you to easily mount a GraphQL endpoint in Phoenix.
3535
%GraphQL.Schema{
3636
query: %GraphQL.ObjectType{
3737
name: "RootQueryType",
38-
fields: [
39-
%GraphQL.FieldDefinition{
40-
name: "greeting",
38+
fields: %{
39+
greeting: %GraphQL.FieldDefinition{
4140
type: "String",
42-
resolve: &TestSchema.greeting/1,
41+
resolve: &TestSchema.greeting/3
4342
}
44-
]
43+
}
4544
}
4645
}
4746
end
4847

49-
def greeting(name: name), do: "Hello, #{name}!"
50-
def greeting(_), do: greeting(name: "world")
48+
def greeting(_, %{name: name}, _), do: "Hello, #{name}!"
49+
def greeting(_, _, _), do: "Hello, world!"
5150
end
5251
```
5352

0 commit comments

Comments
 (0)