A complete OpenAPI 3.0.0 specification for the Cloud Foundry Cloud Controller API (CAPI) v3.195.0, providing 100% coverage of all API endpoints, resources, and operations.
This treats the upstream Cloud Foundry API v3 as the source of truth: https://v3-apidocs.cloudfoundry.org/version/3.195.0/index.html#deprecated-endpoints
The api docs are fetched from the versioned url into the ./data directory and then processed into the OpenAPI YAML files in ./capi/3.195.0.
Currently the process of carving up the API html file into the individual YAML files is done manually, the goal is to automate this part of the process in the future.
Once this has been parsed into the OpenAPI .yml files in ./capi/3.195.0 they are then merged into ./capi/3.195.0.openapi.yaml and .capi/3.195.0.openapi.json files.
From there the OpenAPI specification can be used to generate client SDKs, documentation, etc...
This repository contains a comprehensive OpenAPI specification that fully describes the Cloud Foundry v3 API. The specification is organized into modular YAML files for maintainability and can be used to:
- Generate client SDKs in multiple languages
- Create API documentation
- Perform API testing and validation
- Build developer tools and integrations
- ✅ Complete API Coverage: All 44 resource types and their endpoints
- ✅ Modular Architecture: Organized into separate YAML files per resource
- ✅ Advanced Querying: Label selectors, timestamp operators, field selection
- ✅ Experimental Features: Marked with
x-experimental
extension - ✅ Comprehensive Schemas: Full request/response schemas with examples
- ✅ Metadata Support: Labels and annotations on all resources
- ✅ Async Operations: Job tracking for long-running operations
- ✅ Error Handling: Detailed error schemas and status codes
New to CAPI OpenAPI? Check out our Quick Start Guide for a complete working example.
- Make
- Perl 5.20+
- Go (for oapi-codegen)
- Node.js (for API documentation)
- Your preferred programming language for client generation
# 1. Clone the repository
git clone https://github.com/cloudfoundry-community/capi-openapi-spec.git
cd capi-openapi-spec
# 2. Install dependencies
make install-deps
# 3. Generate OpenAPI specification (JSON is default to avoid Unicode issues)
./bin/gen spec --version=3.195.0
# 4. Generate Go SDK using oapi-codegen (default for Go)
./bin/gen sdk --version=3.195.0 --language=go
# SDK will be created in: sdk/3.195.0/go/capiclient/
-
Generate the OpenAPI specification
make spec
This creates
capi/3.195.0/openapi.json
with automatic type fixes and enhancements -
Generate a client SDK
# Generate Go SDK (uses oapi-codegen by default) make sdk # Generate SDKs for other languages make sdk-python make sdk-java make sdk-typescript # Generate all major SDKs make sdk-all
-
Generate API documentation
# Generate Redocly documentation make docs # Serve documentation locally make docs-serve
# Show all available commands with descriptions
make
# Generate everything (spec, SDK, docs) and run tests
make all
# Generate spec for a specific version
make spec VERSION=3.196.0
# Run all validation tests
make test
# View generated reports
make reports
make view-report REPORT=enhancement
# Compare two API versions
make diff FROM=3.194.0 TO=3.195.0
# Clean all generated files
make clean
# Clean only test-generated SDK files
make clean-test
The bin/gen
script provides a flexible way to generate SDKs for different languages and CAPI versions.
# Generate SDK
./bin/gen --version=VERSION --language=LANGUAGE [--output=PATH] [--generator=GENERATOR]
# Prepare specifications (download and create YAML files)
./bin/gen prepare --version=VERSION
# Merge YAML files into unified OpenAPI spec
./bin/gen merge --version=VERSION
The script supports multiple code generators:
- oapi-codegen (default for Go) - Generates a single, clean Go file with types and client
- openapi-generator (default for other languages) - Full-featured generator with many customization options
# Using default oapi-codegen generator (creates single client.go file)
./bin/gen --version=3.195.0 --language=go
# Output: ./sdk/3.195.0/go/capiclient/client.go
# Using openapi-generator (creates multiple files)
./bin/gen --version=3.195.0 --language=go --generator=openapi-generator
# Output: ./sdk/3.195.0/go/
./bin/gen --version=3.195.0 --language=ruby
# Output: ./sdk/3.195.0/ruby/
./bin/gen --version=3.195.0 --language=python --output=/path/to/my-sdk
# Go SDK for CAPI 3.181.0
./bin/gen --version=3.181.0 --language=go
# Ruby SDK for CAPI 3.181.0
./bin/gen --version=3.181.0 --language=ruby
The generator supports all languages provided by OpenAPI Generator, including:
- go - Go client library
- ruby - Ruby gem
- python - Python package
- java - Java library
- javascript - JavaScript/Node.js
- typescript-node - TypeScript for Node.js
- csharp - C# / .NET
- php - PHP library
- rust - Rust crate
- swift5 - Swift 5
- kotlin - Kotlin
- And many more...
Run ./bin/gen --help
to see the full list of supported languages.
After generating an SDK, you may need to:
- Go:
- With oapi-codegen:
go.mod
is automatically created andgo mod tidy
is run - With openapi-generator: Run
go mod tidy
in the generated directory
- With oapi-codegen:
- Ruby: Build the gem with
gem build *.gemspec
- Python: Install with
pip install -e .
- Java: Build with Maven or Gradle
The repository includes an automated workflow for publishing the Go client to a separate repository for easy consumption.
# Generate the Go client
./bin/gen --version=3.195.0 --language=go
# Publish to github.com/cloudfoundry-community/capi-openapi-go-client
./bin/publish --version=3.195.0
# Dry run to preview what will be published
./bin/publish --version=3.195.0 --dry-run
# Force overwrite if tag already exists
./bin/publish --version=3.195.0 --force
- Go to the Actions tab
- Select "Publish Go Client" workflow
- Click "Run workflow"
- Enter the CAPI version (e.g., 3.195.0)
- Optionally check "Force" to overwrite existing tags
The published Go module will be available at:
import "github.com/cloudfoundry-community/capi-openapi-go-client/capiclient/v3"
- SSH Deploy Key: The GitHub Actions workflow requires a deploy key secret (
CAPI_GO_CLIENT_DEPLOY_KEY
) with write access to the target repository - Target Repository:
github.com/cloudfoundry-community/capi-openapi-go-client
must exist and be configured to accept the deploy key
Component | Version |
---|---|
CAPI API Version | v3.195.0 |
OpenAPI Specification | 3.0.0 |
Last Updated | January 2025 |
Comprehensive documentation is available in the docs/
directory:
- Quick Start Guide - Complete working example with solutions to common issues
- Getting Started Guide - Introduction and quick examples
- API Overview - REST principles, pagination, errors
- Core Resources Guide - Apps, processes, builds, packages
- Services Guide - Service instances, bindings, brokers
- Query Parameters Guide - Advanced filtering and selection
- Client SDK Guide - Generating and using client libraries
The specification covers all Cloud Foundry v3 resources:
- Applications, Processes, Builds, Droplets, Packages
- Revisions, Deployments, Tasks, Sidecars
- Routes, Domains, Route Destinations
- Security Groups, Route Mappings (deprecated)
- Organizations, Spaces, Roles
- Organization Quotas, Space Quotas
- Isolation Segments, Space Features
- Service Instances, Service Bindings
- Service Brokers, Service Plans, Service Offerings
- Service Route Bindings (experimental)
- Jobs (async operations), Manifests
- Feature Flags, Environment Variable Groups
- Audit Events, Usage Events
Features marked as experimental using the x-experimental
extension:
- Route sharing between spaces
- Application manifest diff
- Service route bindings
capi/
├── 3.195.0/
│ ├── apps.yml
│ ├── processes.yml
│ ├── services.yml
│ └── ... (41 resource files)
├── 3.195.0.openapi.yaml (generated)
└── 3.195.0.openapi.json (generated)
bin/
├── gen (main processing script for prepare, merge, and SDK generation)
├── publish (publishes Go client to separate repository)
└── validate (OpenAPI spec validation script)
sdk/
└── VERSION/
└── LANGUAGE/ (generated SDKs)
.github/
└── workflows/
└── publish-go-client.yml (automated publishing workflow)
Validate the OpenAPI specification:
# Using openapi-generator
openapi-generator validate -i capi/3.195.0.openapi.yaml
# Using swagger-cli
swagger-cli validate capi/3.195.0.openapi.yaml
- Fork the repository
- Create a feature branch
- Make your changes to the appropriate YAML files
- Ensure validation passes
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Cloud Foundry Foundation
- Cloud Foundry CAPI Team
- OpenAPI Initiative
- Community Contributors