Skip to content

Latest commit

 

History

History
862 lines (576 loc) · 39 KB

File metadata and controls

862 lines (576 loc) · 39 KB

@theguild/federation-composition

0.22.3

Patch Changes

  • #299 c417891 Thanks @n1ru4l! - Fix REQUIRED_INACCESSIBLE composition rule reporting a composition error if @inaccessible is applied on a non-nullable field with a default value.

    In the following example schema the Query.ping(message:) argument no longer raises REQUIRED_INACCESSIBLE, as a default value for the argument is provided. The same behaviour applies for input type fields.

    extend schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.9"
        import: ["@inaccessible"]
      )
    
    type Query {
      ping(message: String! = "pong" @inaccessible): String!
    }

0.22.2

Patch Changes

  • #295 fffe987 Thanks @n1ru4l! - Fix schema contract composition applying @inaccessible on the federation types ContextArgument and FieldValue on the supergraph SDL.

    This mitigates the following error in apollo-router upon processing the supergraph:

    could not create router: Api error(s): The supergraph schema failed to produce a valid API schema: The following errors occurred:
      - Core feature type `join__ContextArgument` cannot use @inaccessible.
      - Core feature type `join__FieldValue` cannot use @inaccessible.
    

0.22.1

Patch Changes

  • #291 ec0ef84 Thanks @jdolle! - Support "file:" protocol and non-RFC 3986 in imported "link" url argument

  • #282 e507fdd Thanks @kamilkisiela! - Fix supergraph @join__field emission for Federation v1 @external fields and improve override/requires edge-case handling.

    • Drop Federation v1 @join__field(external: true) fields based on key usage in the subgraph instead of aggregated field key usage across subgraphs.
    • Avoid emitting redundant @join__field(external: true) metadata when a field is only required through overridden paths.
    • Tighten @join__field emission around @override and interface type fields.

0.22.0

Minor Changes

  • #267 3e232fa Thanks @kamilkisiela! - Fix supergraph @join__field generation for @override + @requires migrations and add a progressive override restriction.

    When a field with @requires is overridden, composition now ignores @requires usage coming only from the overridden source field when deciding whether to keep @join__field(..., external: true). This prevents stale external annotations in the supergraph.

    Also, progressive override (@override(..., label: ...)) is now rejected when the overridden source field uses @requires (error code: OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE). Non-progressive override behavior is unchanged.

0.21.3

Patch Changes

  • #248 9535d50 Thanks @kamilkisiela! - Fix access validation on union members when selecting __typename in @requires directives.

    The @requires directive validation rule (AuthOnRequiresRule) was not checking authorization requirements for __typename selections on and types. When __typename on a union type was selected, code would throw an unexpected error.

0.21.2

Patch Changes

  • #241 c6e26ed Thanks @kamilkisiela! - Fixes a bug in @key directive validation where an error was incorrectly reported for interfaces implementing another interface with a @key. The validation now correctly applies only to object types implementing the interface.

0.21.1

Patch Changes

  • #230 2b34f17 Thanks @n1ru4l! - Prevent subgraph-specific federation types and scalars being re-declared within the subgraph leaking into the supergraph.

0.21.0

Minor Changes

  • #215 5edf421 Thanks @kamilkisiela! - Enforce correct placement of auth directives. A new validation rule (AUTH_REQUIREMENTS_APPLIED_ON_INTERFACE) rejects any attempt to put these directives on interfaces, interface fields or interface objects.

    Add transitive-auth requirements checking. A new rule verifies that any field using @requires specifies at least the auth requirements of the fields it selects. If a field doesn't carry forward the @authenticated, @requiresScopes or @policy requirements of its dependencies, composition fails with a MISSING_TRANSITIVE_AUTH_REQUIREMENTS error.

    Propagate auth requirements through interface hierarchies. Interface types and fields now inherit @authenticated, @requiresScopes and @policy from the object types that implement them.

  • #215 5edf421 Thanks @kamilkisiela! - Disallowed using @cost on interfaces - you can no longer place @cost on an interface type, its fields, or field arguments. Composition now fails with a clear error instead of accepting it silently.

    The @listSize directive now validates that sizedFields point to list fields, not integer counters (e.g., use edges instead of count).

    Added validation for slicingArguments in @listSize. Only arguments that exist in all subgraphs are kept, invalid ones trigger an error.

Patch Changes

  • #215 5edf421 Thanks @kamilkisiela! - The EXTERNAL_MISSING_ON_BASE rule has been updated to handle @interfaceObject corner‑cases, like @external fields on object types, but provided by interface objects, were triggering false positives.

0.20.2

Patch Changes

  • #198 1b98c17 Thanks @User!, @User!! - Fix public schema SDL in case a object type implements an inaccessible interface.

    Composing the following subgraph:

    schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.3"
        import: ["@inaccessible"]
      ) {
      query: Query
    }
    
    type Query {
    
    }
    
    interface Node @inaccessible {
      id: ID!
    }
    
    type User implements Node {
      id: ID!
    }

    now result in the following valid public SDL:

      type Query {
    
      }
    
    - type User implements Node {
    + type User {
        id: ID!
      }

0.20.1

Patch Changes

0.20.0

Minor Changes

  • #180 a208f1c Thanks @n1ru4l! - Add composeSchemaContract function for composing schema contracts.

    Running the following script:

    import { composeSchemaContract } from "@theguild/federation-composition";
    import { parse } from "graphql";
    
    const result = composeSchemaContract(
      [
        {
          name: "a",
          typeDefs: parse(/* GraphQL */ `
            type Query {
              a: String @tag(name: "public")
            }
          `),
          url: "a.localhost",
        },
        {
          name: "b",
          typeDefs: parse(/* GraphQL */ `
            type Query {
              b: String
            }
          `),
          url: "b.localhost",
        },
      ],
      /** Tags to include and exclude */
      {
        include: new Set(["public"]),
        exclude: new Set(),
      },
      /** Exclude unreachable types */
      true,
    );
    
    console.log(result.publicSdl);

    Will result in the output containing only the fields tagged with public:

    type Query {
      a: String!
    }

0.19.1

Patch Changes

  • #149 9ae49e3 Thanks @n1ru4l! - Fix external key fields on extended object types raising composition errors.

0.19.0

Minor Changes

  • #156 46cb6bc Thanks @n1ru4l! - Support composing executable directive definitions within subgraphs into the supergraph.

0.18.5

Patch Changes

  • #151 f9b9908 Thanks @n1ru4l! - Fix issue where the satisfiability check raised an exception for fields that share different object type and interface definitions across subgraphs.

  • #152 e4440a1 Thanks @n1ru4l! - Fix issue where scalar type marked with @inaccessible does not fail the composition if all usages are not marked with @inaccessible.

    Composing the following subgraphs resulted in an invalid supergraph instead of failing the composition.

    # Subgraph A
    extend schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.9"
        import: ["@inaccessible"]
      )
    
    type Query {
      a: Foo
    }
    
    scalar Foo
    # Subgraph B
    extend schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.9"
        import: ["@inaccessible"]
      )
    
    type Query {
      b: String
    }
    
    scalar Foo @inaccessible

    Now it correctly raises a composition error with the message Type "Foo" is @inaccessible but is referenced by "Query.a", which is in the API schema..

0.18.4

Patch Changes

  • #146 55b48e9 Thanks @n1ru4l! - Resolve usage of @requires FieldSet with a union field selection to raise an EXTERNAL_UNUSED error.

  • #150 9bd8016 Thanks @n1ru4l! - Fix incorrectly raised IMPLEMENTED_BY_INACCESSIBLE error for inaccessible object fields where the object type is inaccessible.

    For example the following subgraph, will no longer result in the error Field B.id is @inaccessible but implements the interface field Node.id, which is in the API schema..

    schema
      @link(url: "https://specs.apollo.dev/federation/v2.9", import: ["@tag"]) {
      query: Query
    }
    
    type Query {
      b(id: ID! @federation__inaccessible): B @federation__inaccessible
      a(id: ID!): A
    }
    
    type B implements Node @federation__inaccessible {
      id: ID! @federation__inaccessible
    }
    
    type A implements Node {
      id: ID!
    }
    
    interface Node {
      id: ID!
    }
  • #147 8c5bc0c Thanks @n1ru4l! - Add support for @provides fragment selection sets on union type fields.

    type Query {
      media: [Media] @shareable @provides(fields: "... on Book { title }")
    }
    union Media = Book | Movie

0.18.3

Patch Changes

  • #143 bcea968 Thanks @n1ru4l! - Do not throw an error when encountering invalid usage of @tag directive within subgraphs.

0.18.2

Patch Changes

  • #141 fdb491f Thanks @ardatan! - Fixes the issue where the composition gives errors in case of the following:

    extend schema
      @link(
        url: "https://specs.apollo.dev/federation/v2.7"
        import: ["@key", "@composeDirective"]
      )
      @link(url: "https://myspecs.dev/myDirective/v1.0", import: ["@myDirective"])
      @composeDirective(name: "@myDirective")
    
    directive @myDirective(myarg: [MyEnum!]!) on OBJECT # A directive with a non-nullable list argument of non-nullable enums
    enum MyEnum {
      MY_ENUM_VALUE
    }
    type Query {
      myRootField: MyObject
    }
    
    type MyObject @myDirective(myarg: []) {
      myField: String
    }

0.18.1

Patch Changes

0.18.0

Minor Changes

  • Support progressive overrides (@override(label: "<value>"))

Patch Changes

  • Performance improvements (lazy compute of errors), especially noticeable in large schemas (2s -> 600ms)

0.17.0

Minor Changes

  • Allow to use @composeDirective on a built-in scalar (like @oneOf)

0.16.0

Minor Changes

  • Allow to use v2.7, but not progressive @override labels
  • Allow to use v2.8, but not @context and @fromContext directives
  • Support @cost and @listSize directives
  • Add extractLinkImplementations function to extract information about applied specs (@link)

Patch Changes

  • Reuse type and direcive definitions from the composition logic to detect a supergraph spec in an SDL or transform a supergraph to a public schema

0.15.0

Minor Changes

  • Implement rule for IMPLEMENTED_BY_INACCESSIBLE error code.

0.14.5

Patch Changes

  • #87 9c26af9 Thanks @n1ru4l! - Do not raise DEFAULT_VALUE_USES_INACCESSIBLE for inaccessible default value on inaccessible field.

0.14.4

Patch Changes

  • #82 7d640bf Thanks @kamilkisiela! - Fix a child data type field not being accessible via interfaceObject

  • #81 ded4b47 Thanks @ardatan! - Respect inaccessible enum values while creating the public schema from the supergraph AST

0.14.3

Patch Changes

  • #78 4e25e6d Thanks @kamilkisiela! - transformSupergraphToPublicSchema removes now @policy, @requiresScopes and @authenticated

0.14.2

Patch Changes

  • #76 a3cb724 Thanks @kamilkisiela! - Fix a missing @join__field on a query field where @override is used, but not in all subgraphs.

0.14.1

Patch Changes

  • #74 7456d14 Thanks @kamilkisiela! - Show TYPE_KIND_MISMATCH and ignore INTERFACE_FIELD_NO_IMPLEM when there is a type kind mismatch

0.14.0

Minor Changes

0.13.0

Minor Changes

0.12.1

Patch Changes

  • #68 51dd57a Thanks @kamilkisiela! - Unknown types are now always reported as GraphQLError (previously in some logic paths, it was an exception).

0.12.0

Minor Changes

0.11.4

Patch Changes

0.11.3

Patch Changes

  • #62 e50bc90 Thanks @kamilkisiela! - Fix: do not expose federation__Scope and federation__Policy scalar definitions to a supergraph

0.11.2

Patch Changes

  • #60 2f7fef1 Thanks @kamilkisiela! - Normalize enum values to be printed as enum values in Supergraph SDL, even if the user's subgraph schema has them as strings

0.11.1

Patch Changes

0.11.0

Minor Changes

Patch Changes

0.10.1

Patch Changes

0.10.0

Minor Changes

Patch Changes

0.9.0

Minor Changes

0.8.2

Patch Changes

  • #46 cfa9950 Thanks @kamilkisiela! - Add requiresScopes__Scope and policy__Policy to transformSupergraphToPublicSchema

  • #44 de983b0 Thanks @kamilkisiela! - Add containsSupergraphSpec to detect if Supergraph related scalars, enums or directives are used

0.8.1

Patch Changes

  • #42 f858c3f Thanks @n1ru4l! - Fix REQUIRED_INACCESSIBLE occurring on inaccessible fields/input types

0.8.0

Minor Changes

  • #40 4cba351 Thanks @n1ru4l! - Implement validation rules for REQUIRED_INACCESSIBLE for input types and field arguments.

0.7.1

Patch Changes

  • #36 fdba937 Thanks @kamilkisiela! - Visit every field in provides and requires directives

  • #36 fdba937 Thanks @kamilkisiela! - Fix unnecessary join__field(override:) on Query fields when it points to non-existing subgraph

  • #36 fdba937 Thanks @kamilkisiela! - Deduplicate composed directives

  • #39 e77eb2c Thanks @n1ru4l! - Ignore inaccessible field arguments within the DEFAULT_VALUE_USES_INACCESSIBLE rule.

    Fixes an issue where an inaccessible field argument uses a default value that is inaccessible would cause a false error.

    type User @key(fields: "id") {
      id: ID
      friends(type: FriendType = FAMILY @inaccessible): [User!]!
    }
    
    enum FriendType {
      FAMILY @inaccessible
      FRIEND
    }
  • #36 fdba937 Thanks @kamilkisiela! - Remove duplicated link spec definitions

  • #36 fdba937 Thanks @kamilkisiela! - Drop unused fields marked with @external only in a single type in Fed v1

  • 220dfc0 Thanks @kamilkisiela! - Fix missing usedOverridden on non-external key field

0.7.0

Minor Changes

Patch Changes

0.6.2

Patch Changes

  • 1ddf34e Thanks @kamilkisiela! - Fix EXTERNAL_ARGUMENT_MISSING - include nullable arguments as well

  • 1ddf34e Thanks @kamilkisiela! - Merge type definitions and type extensions when validating fields used in @requires, @provides and @key

  • 2525a24 Thanks @kamilkisiela! - Support [T!]! type in @key(fields), @provides(fields) and @requires(fields)

0.6.1

Patch Changes

0.6.0

Minor Changes

Patch Changes

0.5.0

Minor Changes

0.4.0

Minor Changes

Patch Changes

0.3.0

Minor Changes

  • #23 2d72e03 Thanks @kamilkisiela! - Add sortSDL function to sort DocumentNode (type system definitions and extensions)

0.2.0

Minor Changes

  • #21 443283e Thanks @n1ru4l! - Remove stripFederationFromSupergraph in favor of transformSupergraphToPublicSchema.

    Instead of stripping only federation specific types, transformSupergraphToPublicSchema yields the public api schema as served by the gateway.

0.1.4

Patch Changes

  • #19 e0ef0bb Thanks @kamilkisiela! - Make stripFederationFromSupergraph less strict and remove only Federation directives

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes

0.0.0

Minor Changes

Patch Changes