Working with Types and Fields - WunderGraph Hub

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Working with types and fields in Hub lets you build and modify your GraphQL API schema at the supergraph level, with changes automatically propagating to assigned subgraphs. The interface handles validation and generates proper GraphQL syntax for federated architectures.

Creating Types and Fields

Access the creation interface through the Create button in your workspace. The creation dialog provides two modes: New Fields for adding to existing types, and New Type for creating entirely new types with initial fields.

Creating New Types

When creating a new type, choose from:

Enter the type name and select fields to include. Each field requires a name and type selection from available schema types.

Adding Fields to Existing Types

Select an existing type from the dropdown to add new fields. The interface shows available types that can accept new fields (Object, Input Object, and Enum types). For each field you can configure:

Subgraph Assignment

All types and fields are created at the supergraph level and then assigned to specific subgraphs for federation. This allows you to control which services own different parts of your schema.

Assigning Types to Subgraphs

Use the Assign to option in the subgraph management menu to assign entire types to specific subgraphs. When you assign a type, all its fields are automatically included in that subgraph. The system automatically imports all dependencies - if referenced types don’t exist in the target subgraph, they are automatically imported to maintain schema integrity.

Assigning Individual Fields

Individual fields can be assigned to different subgraphs than their parent type, enabling cross-service field distribution. This is useful for federated architectures where different services contribute fields to the same type. Dependencies for field types are automatically imported into the target subgraph when needed.

Editing Fields

Edit existing fields by clicking the edit icon next to any field on the canvas. The field editor provides:

Field Arguments

For Object and Interface type fields, you can add arguments that accept parameters. Each argument has a name and type, arguments use input types from your schema, and support for required/optional and list configurations is included. Real-time validation ensures argument names and types are valid.

Validation and Feedback

The system provides immediate validation including:

All changes update your schema in real-time, with generated GraphQL syntax available for preview. The interface prevents invalid configurations and provides clear error messages when validation fails.

Removal and Deletion

Hub provides granular control over removing schema elements at different levels:

Remove from Specific Subgraphs

Remove fields or types from specific subgraphs while keeping them in the supergraph and other subgraphs. This is useful for gradually migrating functionality between services.

Complete Deletion

Delete fields or types entirely from both the supergraph and all subgraphs. This permanently removes the schema element from your API.

Field Arguments

Arguments can be added, modified, or removed from fields. Argument changes automatically propagate to all subgraphs that contain the parent field. Changes integrate with Hub’s proposal system for collaborative schema evolution and can be tested immediately in the Operation Builder nodes.