Skip to content

Commit

Permalink
document
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Nov 28, 2023
1 parent b086f46 commit 14df2e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

### Added

- Add `@namespaced` directive for namespacing by separation of concerns https://github.com/nuwave/lighthouse/pull/2469

## v6.23.1

### Fixed
Expand Down
26 changes: 7 additions & 19 deletions docs/master/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,8 @@ A [@namespace](#namespace) directive defined on a field directive wins in case o

```graphql
"""
A no-op nested field resolver that allows nesting of queries and mutations.
Provides a no-op field resolver that allows nesting of queries and mutations.
Useful to implement [namespacing by separation of concerns](https://www.apollographql.com/docs/technotes/TN0012-namespacing-by-separation-of-concern/).
"""
directive @namespaced on FIELD_DEFINITION
```
Expand All @@ -2296,31 +2297,18 @@ type Query {
}

type PostQueries {
single(
id: ID @eq
): Post! @find

list(
title: String @where(operator: "like")
): [Post!]! @paginate(defaultCount: 10)
single(id: ID @eq): Post! @find
list(title: String @where(operator: "like")): [Post!]! @paginate(defaultCount: 10)
}

type Mutation {
posts: PostMutations! @namespaced
}

type PostMutations {
create(
input: PostCreateInput @spread
): Post! @create

update(
input: PostUpdateInput @spread
): Post! @update

delete(
id: ID! @whereKey
): Post @delete
create(input: PostCreateInput @spread): Post! @create
update(input: PostUpdateInput @spread): Post! @update
delete(id: ID! @whereKey): Post @delete
}
```

Expand Down
5 changes: 3 additions & 2 deletions src/Schema/Directives/NamespacedDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ public static function definition(): string
{
return /** @lang GraphQL */ <<<'GRAPHQL'
"""
A no-op nested field resolver that allows nesting of queries and mutations.
"""
Provides a no-op field resolver that allows nesting of queries and mutations.
Useful to implement [namespacing by separation of concerns](https://www.apollographql.com/docs/technotes/TN0012-namespacing-by-separation-of-concern/).
"""
directive @namespaced on FIELD_DEFINITION
GRAPHQL;
}
Expand Down

0 comments on commit 14df2e0

Please sign in to comment.