graphql-armory 0.1.0.pre12 → 0.1.0.pre13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +3 -3
- data/docs/versioning.md +540 -0
- data/lib/graphql/armory/authorization/audit/findings.rb +6 -1
- data/lib/graphql/armory/authorization/audit/overrides.rb +8 -2
- data/lib/graphql/armory/authorization/audit/payload_reuse.rb +9 -8
- data/lib/graphql/armory/authorization/definitions.rb +8 -92
- data/lib/graphql/armory/authorization.rb +3 -1
- data/lib/graphql/armory/definitions.rb +111 -0
- data/lib/graphql/armory/location.rb +101 -0
- data/lib/graphql/armory/version.rb +1 -1
- data/lib/graphql/armory/versioning/audit/command.rb +43 -0
- data/lib/graphql/armory/versioning/audit/own_checks.rb +139 -0
- data/lib/graphql/armory/versioning/audit/profiles.rb +123 -0
- data/lib/graphql/armory/versioning/audit/subscription_triggers.rb +98 -0
- data/lib/graphql/armory/versioning/audit.rb +559 -0
- data/lib/graphql/armory/versioning/controls.rb +403 -0
- data/lib/graphql/armory/versioning/decision.rb +89 -0
- data/lib/graphql/armory/versioning/deprecation.rb +95 -0
- data/lib/graphql/armory/versioning/diff/command.rb +49 -0
- data/lib/graphql/armory/versioning/diff.rb +349 -0
- data/lib/graphql/armory/versioning/dump/command.rb +46 -0
- data/lib/graphql/armory/versioning/dump.rb +107 -0
- data/lib/graphql/armory/versioning/gate.rb +140 -0
- data/lib/graphql/armory/versioning/integration.rb +903 -0
- data/lib/graphql/armory/versioning/lifecycle.rb +61 -0
- data/lib/graphql/armory/versioning/profiles.rb +122 -0
- data/lib/graphql/armory/versioning/rspec.rb +38 -0
- data/lib/graphql/armory/versioning/versions.rb +111 -0
- data/lib/graphql/armory/versioning/view.rb +61 -0
- data/lib/graphql/armory/versioning.rb +132 -0
- data/lib/graphql/armory.rb +1 -0
- data/lib/tasks/graphql_armory.rake +20 -0
- metadata +24 -2
- data/lib/graphql/armory/authorization/location.rb +0 -103
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e1c1031aac2b8bb370345a622fb7d74403aa06594656cf72b4178469364db71
|
|
4
|
+
data.tar.gz: e0a45f56b54f68e2118eeb3ace191ce138cf48f2e120b8c9ac79d29dbcc77a3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08b594e550521e1fa3b9c2677b6c104fa84713156bfd62a7e6a32c5accb843ff9281e87d2333d8c6bdb7cb110f05c37a65c057a085ff2b21f63b30320dc2b4f0'
|
|
7
|
+
data.tar.gz: 16d4f937c3083050a8c7a12263614597bfd5f40461e3ebf07892dc385215505a7e2f00448daf19a00593de27a26608667c3d30feec5125d0941bc336d61f9a44
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.1.0.pre13 (2026-11-04)
|
|
4
|
+
|
|
5
|
+
This release adds [API versioning](docs/versioning.md): each client gets the schema of the version it names, so fields, arguments, enum values and types can arrive, be deprecated and leave without breaking older clients. It comes with an audit that finds, before production, every query a version would refuse and every member it would serve or leave out by mistake, plus a diff and an SDL dump per version. Upgrade if you need to evolve a public schema; nothing existing changes.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- API versioning: each client gets the schema of the version it names, so a field can be added or removed without breaking clients built against an older version. `use GraphQL::Armory::Versioning, versions: %w[2024-06-01 2025-01-01], default: :latest` declares the versions (oldest first, `retired:` for the ones no longer served), `include GraphQL::Armory::Versioning::Base` in your base field class gives `field` the `added:` and `removed:` keywords, and your controller passes `context: { armory_version: request.headers["X-API-Version"] }`. The version applies to validation, both engines, introspection, suggestions and `to_definition`. A retired, unknown or malformed version is refused before anything runs, with `extensions.code` `RETIRED_API_VERSION` or `UNKNOWN_API_VERSION`; a request with no version follows the required `default:` (`:latest`, a label, or `:refuse` with `MISSING_API_VERSION`). `GraphQL::Armory::Versioning.version(context)` tells resolvers which version a query sees; signals `:version_served`, `:version_defaulted` and `:version_refused`. Arguments, input-object fields, arguments of your own query directives and enum values take `added:` and `removed:` too, through `Base` in their base classes; a `default_value:` naming a member outside a served version, a versioned argument or enum value shadowing its parent class's, and, on a directive used in the SDL (or a subclass of one), an argument with a lifecycle or whose type reaches versioned members are refused with `ConfigurationError`. Types take `lifecycle added:, removed:` (objects, interfaces, unions, enums, scalars, input objects, mutations), which hides every field and argument that uses them and every field they declare; a mutation's input and payload types follow it, and an object of a type outside the version is not authorized when an argument `loads:` an interface or union. `GraphQL::Armory::Versioning.types(schema, label)` answers one version's schema to tooling. A lifecycle on a root type, a versioned type in `extra_types` and `added:`/`removed:` on `implements` or `possible_types` need a type membership class with `Base`: a membership then lives only in its versions, with the interface's fields. A field, argument or enum value can have two definitions on one owner with lifecycles that do not overlap, to change its shape across versions; overlapping ones are refused, and Authorization's audit reads the pair as one member. Two type classes can share a `graphql_name` the same way, each returned by its own field twin; a `LateBoundType` naming such a type is refused, and the audit judges each twin's rule and no longer misses a reused mutation payload behind a late-bound name with twins. `GraphQL::Armory::Versioning::Audit.(schema)`, `expect(AppSchema).to have_consistent_versions` (`require "graphql/armory/versioning/rspec"`) and `rake "graphql_armory:versions:audit[AppSchema]"` report, before production, every refusal a query of a served version would hit and every member a version lists outside its lifecycle (kinds `:plugin`, `:visibility`, `:refused`, `:duplicate`, `:empty`, `:undeclared_version`, `:outside_lifecycle`, `:unchecked`), and what a version silently leaves out: a required argument hidden because its type is (`:implicit`; an optional one is listed as information, which `ok?` ignores), a type with no field or a union with no member (`:empty`), and an interface with no implementer (`:orphan_interface`). Limits: a `resolve_type` answering a type outside the client's version raises `UnresolvedTypeError`; a resolver returning an enum value outside the client's version raises graphql-ruby's `UnresolvedValueError`; lookups with no query (`Type.get_field`) see every field; a named `Schema::Visibility` profile of your own is refused. [API versioning](docs/versioning.md).
|
|
10
|
+
- Versioning's audit now reports fields served by another definition of their name or dropped while an interface declares them (`:fallback`), your own `visible?` methods ahead of the plugin's, declared through the new `own_checks:` option (`:own_check`), defaults naming values or input fields a version does not have (`:default_value`), and subscription arguments that differ between versions and break `trigger` (`:subscription_trigger`). [The audit](docs/versioning.md#the-audit).
|
|
11
|
+
- `deprecated: "<version>"` with `deprecation_reason:` deprecates a field, argument, input field or enum value only from that version on, by defining the member twice (before and from that version) through the class that declares it; it is refused on subscription arguments, and Authorization's audit lists a problem the pair shares once. [Deprecating](docs/versioning.md#deprecating). (#74)
|
|
12
|
+
- `Versioning::Diff.(schema, from:, to:)` lists what changes between two served versions as breaking, dangerous or safe, with `rake "graphql_armory:versions:diff[AppSchema,FROM,TO]"` (exit 1 when something breaks) and `expect(AppSchema).to have_no_breaking_changes(from:, to:)`; `Versioning::Dump.(schema, dir)` and `rake "graphql_armory:versions:dump[AppSchema,schema]"` write each served version's SDL plus `latest.graphql`; and a new "Evolving a version" guide covers add, deprecate, remove and retire. [Evolving a version](docs/versioning.md#evolving-a-version).
|
|
13
|
+
- `use GraphQL::Armory::Versioning, ..., profiles: true` (graphql 2.4.10 or later) runs each query under its version's named `Schema::Visibility` profile, built by `GraphQL::Armory::Versioning.profiles(schema)`, so each version's visibility is computed once (at boot with `preload: true`); a query naming any other profile raises `ConfigurationError`. The audit gains `:profiles` and `:retired_only`, and `benchmark/versioning.rb` measures the cost. `Audit.(schema, strict: true)` makes `:retired_only` a problem, and a `visible?` declared in `own_checks:` is not reported as `:profiles`. Limit: under a profile, Authorization's `visible_when:` raises and your own `visible?` is asked once per version, so it must not read the user. Without `profiles: true`, a query under a named `Schema::Visibility` profile of your own raises `ConfigurationError` when it is built: on graphql before 2.4.10 such a profile keeps the first query's version for every later query. [One visibility profile per version](docs/versioning.md#one-visibility-profile-per-version). (#74)
|
|
4
14
|
|
|
5
15
|
## 0.1.0.pre12 (2026-11-04)
|
|
6
16
|
|
data/README.md
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
Open-source extensions for [graphql-ruby](https://github.com/rmosolgo/graphql-ruby), built on its public extension points: no fork, no monkey patching. One gem, one module at a time; each module has its own page in [`docs/`](docs) with the problem it solves, how to use it, and its limits.
|
|
8
8
|
|
|
9
|
-
> **Status: early development.** Prereleases on RubyGems (`0.1.0.
|
|
9
|
+
> **Status: early development.** Prereleases on RubyGems (`0.1.0.pre13`). The API may change before 1.0.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
|
-
gem "graphql-armory", "~> 0.1.0.
|
|
14
|
+
gem "graphql-armory", "~> 0.1.0.pre13" # a prerelease: `gem install graphql-armory --pre`
|
|
15
15
|
gem "pundit" # or "cancancan", for the authorization module
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ Status: ✅ released, 🚧 in progress, ⬜ not started. Update this table in th
|
|
|
30
30
|
| 5 | Stable (keyset) connections | ✅ | [docs/keyset-connections.md](docs/keyset-connections.md) | Released in 0.1.0.pre7 (prerelease). `Keyset.build(relation)` per resolver, ActiveRecord only, plain non-null columns of the relation's own table. Base64 cursors refused unless `plain_cursors: true`. No total count. `use` checks the cursor encoder when the schema loads, from 0.1.0.pre10. |
|
|
31
31
|
| 6 | Subscriptions over Pusher / Ably | ⬜ | | Research not started. |
|
|
32
32
|
| 7 | Response caching | ⬜ | | Research not started. |
|
|
33
|
-
| 8 | API versioning (
|
|
33
|
+
| 8 | API versioning | ✅ | [docs/versioning.md](docs/versioning.md) | Released in 0.1.0.pre13 (prerelease). Versions per request (`context[:armory_version]`) with refusal codes and a required `default:` policy; `added:`/`removed:` on fields, arguments, enum values, types and memberships, and two definitions of one name to change its shape; `deprecated:` from one version on; an audit (`have_consistent_versions`, `rake graphql_armory:versions:audit`) of what each served version would refuse, serve outside its lifecycle or leave out; a diff of two versions (`have_no_breaking_changes`, `rake graphql_armory:versions:diff`) and a per-version SDL dump; and `profiles: true`, one `Schema::Visibility` profile per version (graphql 2.4.10 or later). |
|
|
34
34
|
| 9 | `@defer` / `@stream` | ⬜ | | Research not started. |
|
|
35
35
|
| 10 | Dashboard | ⬜ | | Research not started. |
|
|
36
36
|
|