Replies: 1 comment
-
Discussion 29/04/2026
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This document proposes a unified CLI user flow for API Platform that enables users to manage API projects and interact with platform components through a consistent command structure.
The CLI is designed to treat the Management Portal, Gateway, and Developer Portal as independent components. Users can configure and operate each component separately, while the CLI directly communicates with each system when executing commands such as build, push, and publish.
It also introduces a standard API project structure and environment-based configuration, allowing users to manage APIs from initialization to deployment using a single, predictable workflow.
Initial Discussion for CTL design can be found from here: #356
Goals
Core Concepts
CLI Environment
A CLI environment is a named configuration context representing a workspace of connected components. It's a logical boundary used to group related components such as Management Portals, Gateways & Developer Portals withing the API platform.
Each environment can contain:
When the CLI is first installed, default environment will be always exists. So, users do not need to create an environment to use the CLI.
Users can add Management Portals, Gateways & Devportals to the environment.
If multiple environments exist, user can switch the active environment. All the subsequent commands will be executed against the active environment if user doesn't specifically select the environment.
Command Categories:
init,add env,list,add)build,deploy,publish), use the selected environment context if no environment specifically addedorgcontext for Devportal & Management Portal, the commands comes in this category maps to the functionalities define through REST API of the Service.Command Execution logic
Ex:
This approach is useful for scripting and automation, where each command must be self-contained.
Ex:
Context Resolution Behavior
When a command is executed without explicit arguments, the CLI resolves values using the current context:
--envis not provided, the CLI uses the active environment.--nameis not provided, the CLI uses the selected component within the active environment.--orgis not provided, the CLI uses the currently set organization.--fileis not provided, the CLI attempts to resolve the API project from the current directory.If any required context is missing, the CLI should prompt the user or return an error.
API Project
An API project is similar to a git repository - it's a directory-based workspace where you can run commands from anywhere within the project structure.
Project identification
For a directory to be recognized as an API project, it must contain:
.api-platform/directoryconfig.yamlfile within.api-platform/Command Resolution
When the user executes a command, the tool initiates an upward traversal:
.api-platform/config.yaml.--pathflag to point the project folder to provide support to run the commands from anywhereComponent Independance
The CLI treats the Management Portal, Gateway, and Developer Portal as independent systems under an environment. The tool does not interact with one component through another.
High-level CLI User Flow
flowchart TD A[Install API Platform CLI] --> B[Default environment is available] B --> C[Add platform components] C --> C1[Add Management Portal] C --> C2[Add Gateway] C --> C3[Add Developer Portal] C1 --> D[Add/Set active environment] C2 --> D C3 --> D D --> E[Initialize API project] E --> F[Create API project structure] F --> G[Design or edit API definition] G --> H[Build gateway artifact] G --> I[Build developer portal artifact] H --> J[Push directly to Gateway] I --> K[Push directly to Developer Portal] G --> L[Push directly to Management Portal] J --> M[API deployed in Gateway] K --> N[API published in Developer Portal] L --> O[API registered in Management Portal]CLI User Flow
Step 1: Setting up the Environment
Before performing project operations, the user must configure the required components: management portal, gateways, devportals and authenticate.
Users can use either interactive or non interactive mode to add platform component with desired auth type
Upon successful addition & authentication, users can use global level commands to manage components & get the component status.
Ex:
listap devportal listremoveap devportal remove --display-name <name>useap devportal use --name <name>currentap devportal currentStep 2: Initialize API Project
There are two ways to create API Project
**Output after Step 2: **
Folder Structure
File:
.api-platform/config.yamlFile:
api.yamlStep 3: Design API Using Designer Tool
User edits the
definition.yamlfile using the Designer tool to define paths, operations, schemas, etc.Generate the
gateway.yaml**Option A: ** Auto-sync (if enabled in config.yaml)
gateway.yamlis regenerated automatically**Option B: ** Manual Generation
ap gateway buildorap gateway build --path <API-Project-path>Output After Step 3:
File:
gateway.yamlStep 4: Build Devportal Artifact
Command:
What Happens after the command
This checks for any existing developer portal configurations in the project. (using config.yaml)
If no portal configuration exists in config.yaml, the tool initializes a /devportal directory and updates config.yaml.
Output:
✓ Default devportal artifact initialized and built successfully Next Steps: Run 'ap devportal publish' to publish to devportal.build/devportal-name.zip)Output after Step 5:
Directory Structure:
File:
.api-platform/config.yamlFile:
devportal/devportal.yamlStep 5: Push Artifacts to Platform Components
Import API to Management Portal
When execute this:
gateway.yaml,api.yaml,definition.yamlanddocs/to management portal.*Output:
shell output:
FIle:
api.yamlwill be updated with API IDPush API to Devportal
Output:
Deploy API to Gateway
# Deploy to a specific gateway ap gateway apply -f gateway.yamlWhat happens:
gateway.yamlfrom the path specified in.api-platform/config.yamlOutput:
Beta Was this translation helpful? Give feedback.
All reactions