Skip to content

Commit 6f648a7

Browse files
authored
docs: update README with guidelines for module naming and structure (#315)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent a9a401c commit 6f648a7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/adrs/4615273139/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ resolver's purpose.
8686
- You **MUST NOT** create subdirectories/namespace to group mutations or queries.
8787
- You **MUST** keep the modules under a flat structure.
8888
- You **MUST** use the `Batch` prefix for batch mutations.
89+
- You **MUST NOT** use the `Of[Parent Object Name]` suffix when the field is
90+
defined within an object that is intended to be flattened via `import_fields`.
91+
The field name alone **MUST** be used as the module name since these fields
92+
are imported into the parent schema and lose their original object context.
8993

9094
### Example
9195

@@ -121,10 +125,20 @@ defmodule Umbrella.Web.Graphql.Schema do
121125
end
122126
end
123127

128+
# Object intended for import_fields - no "Of" suffix needed
129+
object :banking_queries do
130+
field :pending_transfers, list_of(:transfer) do
131+
resolve &Query.PendingTransfers.resolve/3
132+
end
133+
end
134+
124135
query do
125136
field :deposit_account, non_null(:deposit_account) do
126137
resolve &Query.DepositAccount.resolve/3
127138
end
139+
140+
# Fields imported from banking_queries object
141+
import_fields(:banking_queries)
128142
end
129143

130144
mutation do

0 commit comments

Comments
 (0)