Federation Scalars

Apollo Federation scalar types used in pyck

Audience: Programmer

Federation scalars are special scalar types used by Apollo Federation for distributed GraphQL schema composition. These scalars are primarily used internally by the federation runtime and are not typically used directly in client queries.

Available Federation Scalars

join__FieldSet

A string representation of a selection set used to specify fields for federation key directives.

Type: String

Usage: Used in @key directives to define entity keys across services.

type InventoryItem @key(fields: "id") @key(fields: "sku") {
  id: ID!
  sku: String!
  name: String!
}

Represents an import statement for federation directives and types.

Type: String

Usage: Used to import federation specifications and features.

Understanding Federation in pyck

pyck uses Apollo Federation to compose multiple GraphQL services into a single unified API:

  1. Attachments Service: Handles file uploads and attachments

  2. Inventory Service: Manages inventory items, movements, and repositories

  3. MainData Service: Handles master data (customers, suppliers, data types)

  4. Management Service: Manages companies, users, and access control

  5. Picking Service: Handles picking orders and order fulfillment

  6. Receiving Service: Manages inbound shipments and receiving

  7. WorkflowService: Orchestrates Temporal workflows

Federation Directives

While not scalars, these directives work with federation scalars:

  • @key: Defines the primary key for an entity

  • @requires: Specifies fields needed from other services

  • @provides: Indicates fields provided by this service

  • @external: Marks fields defined in another service

  • @extends: Extends a type from another service

Example: Federated Entity

Client Perspective

From a client's perspective, federation is transparent. You query the unified schema without needing to know about the underlying service boundaries:

Best Practices

  1. Let Federation Handle It: These scalars are managed by the federation runtime

  2. Focus on the API: As a client developer, work with the composed schema

  3. Understand Service Boundaries: Knowing which service owns which data can help with performance optimization

See Also

Last updated

Was this helpful?