Skip to content

Commit

Permalink
Add note about changeset definition order
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Feb 19, 2024
1 parent 95767bb commit b0d289e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions guides/changesets/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@ To be available to clients, Changesets added to the schema with `use GraphQL::En

```ruby
class MyAppSchema < GraphQL::Schema
# Add this before root types so that newly-added types are also added to the schema
use GraphQL::Enterprise::Changeset::Release, changeset_dir: "app/graphql/changesets"

query(...)
mutation(...)
subscription(...)
end
```

This attaches each Changeset defined in `app/graphql/changesets/*.rb` to the schema. (It assumes Rails conventions, where an underscored file like `app/graphql/changesets/add_some_feature.rb` contains a class like `Changesets::AddSomeFeature`.)

{% callout warning %}

Add `GraphQL::Enterprise::Changeset::Release` _before_ hooking up your root `query(...)`, `mutation(...)`, and `subscription(...)` types. Otherwise, the schema may not find links to types in new schema versions.

{% endcallout %}

Alternatively, Changesets can be explicitly attached using `changesets: [...]`, for example:

```ruby
Expand All @@ -27,6 +38,7 @@ class MyAppSchema < GraphQL::Schema
Changesets::DeprecateRecipeFlag,
Changesets::RemoveRecipeFlag,
]
# ...
end
```

Expand Down

0 comments on commit b0d289e

Please sign in to comment.