Program graph

CLI reference

CLI reference

Commands for the YDYL Program graph CLI, including their purposes, use cases, and examples.

Initialize a workspace

ydyl-graph init

Purpose

Creates a new Program graph workspace using an example template or an existing project model. It sets up the folder structure, configuration files such as graph.yaml, and starter mappings.

Use case

  • Use this command when starting a new Program graph project for a portfolio or program.
  • Specify a source system or schema to scaffold a workspace tailored to a specific data model.

Example

ydyl-graph init --from-schema portfolio.graphql --env sandbox

Generate types from schemas

ydyl-graph codegen

Purpose

Generates strongly typed models from your graph schema and source definitions.

Use case

  • Run after changing schema.graphql or adding/updating source definitions.
  • Creates type-safe classes for interacting with graph data in your resolvers or mappings.

Build your graph

ydyl-graph build

Purpose

Compiles the graph workspace to an optimized bundle, preparing it for deployment to YDYL.

Use case

  • Run after completing mappings and configuration.
  • Ensures the graph is ready for deployment in the format required by the YDYL runtime.

Deploy your graph

ydyl-graph deploy

Purpose

Deploys the compiled graph to the YDYL Program graph service.

Use case

  • Run after building your graph to upload and activate it.
  • Specify the deployment target (sandbox, staging, or production) and the graph name.

Example

ydyl-graph deploy <your_graph> --env production 
  --endpoint https://graph.ydyl.global 
  --deploy-key <your_api_key>

Run the graph locally

ydyl-graph dev

Purpose

Runs a local development environment to test the graph with simulated or mirrored data.

Use case

  • Use while developing and testing your graph locally.
  • Simulate events and validate mappings without deploying to a live YDYL environment.

Execute unit tests

ydyl-graph test

Purpose

Runs the YDYL testing harness to execute unit tests for a graph workspace.

Use case

  • Write and run unit tests for mappings and resolvers to ensure your graph logic works correctly.

Add new data source

ydyl-graph add-source

Purpose

Adds a new data source to your graph manifest (graph.yaml) and updates related files such as schema.graphql and mappings.

Use case

  • Use when adding additional upstream systems or data sources to your graph.
  • Automates updates to configuration and related files.

Example

ydyl-graph add-source projects --from-endpoint https://api.internal/portfolio

Ensure you have the latest version of the CLI installed to avoid issues with deprecated or updated commands.