Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
container:
image: node:24-alpine
permissions:
contents: read
pages: write
Expand All @@ -23,9 +25,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
- name: Setup
run: |
apk add python3 make g++
yarn install
- name: Build
run: |
yarn build
- name: Configure Pages
uses: actions/configure-pages@v5
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
container:
image: node:24-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
run: yarn install
run: |
apk add python3 make g++
yarn install
- name: Stats
run: yarn run redocly stats --format markdown >> $GITHUB_STEP_SUMMARY
run: yarn redocly stats --format markdown >> $GITHUB_STEP_SUMMARY
- name: Lint
run: |
yarn run redocly lint --format markdown >> $GITHUB_STEP_SUMMARY || true
yarn run redocly lint --format github-actions
yarn redocly lint --max-problems 9999 --format markdown >> $GITHUB_STEP_SUMMARY || true
yarn redocly lint --max-problems 9999 --format github-actions
- name: Build
run: yarn build
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Cloud Foundry CAPI OpenAPI Specification
# Cloud Foundry CAPI OpenAPI Specification - Experimental

This repository contains the OpenAPI 3.0 specification for the Cloud Foundry API (CAPI). It provides a complete, machine-readable definition of the CAPI endpoints, enabling automated client generation, documentation, and testing.
> **Note:** This repository is an experimental project to explore the OpenAPI specification for the Cloud Foundry API (CAPI). It is not an official Cloud Foundry project and may not be suitable for production use.

The rendered documentation can be viewed at: [https://flothinkspi.github.io/cf-api-openapi-poc/](https://flothinkspi.github.io/cf-api-openapi-poc/)
This repository contains the OpenAPI 3.0 specification for the Cloud Foundry API (CAPI). It provides a complete, machine-readable definition of the CAPI endpoints, enabling automated client generation, documentation, and testing.

## Project Structure

Expand Down Expand Up @@ -40,31 +40,31 @@ The repository is organized as follows:

**Linting**

`yarn run lint`
`yarn lint`

Lints the OpenAPI specification files using [`redocly lint`](https://github.com/Redocly/redocly-cli) to ensure they adhere to the defined rules and best practices. This helps maintain consistency and quality in the specification.

**Building**

`yarn run build`
`yarn build`

Executes the `bin/build.js` script to bundle the modular OpenAPI files from `apis/cf/**/` into individual bundled `openapi.yaml` files in the `dist/` directory. It uses [`redocly`](https://github.com/Redocly/redocly-cli) to merge the different OpenAPI files into a single file for each version.

**Previewing**

`yarn run preview`
`yarn preview`

First, this command runs the build script to ensure the latest specification is bundled. Then, it starts a local HTTP server using `http-server` to serve the `dist/` directory. This allows you to preview the generated documentation locally in your browser.

**Creating a new version**

`yarn run create-version 3.131.0`
`yarn create-version 3.131.0`

Runs the `bin/create-version.js` script, which is used to create a new versioned directory under `apis/cf/`. This is useful when a new version of the CAPI is released and you need to update the specification. It copies the current `apis/cf/latest/openapi.yaml` to a new versioned directory, and maintains the `redocly.yaml` file for the new version. After running this command and rebuilding, the new version will be available in scalar.

**Compliance Testing**

`yarn run test:compliance https://api.example.com dist/latest/openapi.yaml`
`yarn test:compliance https://api.example.com dist/latest/openapi.yaml`

Executes the `bin/test-compliance.js` script to run compliance tests against the OpenAPI specification. This ensures that the specification is valid and conforms to the OpenAPI standard. It uses [`wiretap`](https://github.com/pb33f/wiretap) that acts like a proxy server to intercept requests and validate them against the OpenAPI spec.

Expand All @@ -85,7 +85,7 @@ Hereby `Wiretap` acts as a proxy server that intercepts HTTP requests and respon

**Mock Server**

`yarn run test:mockserver`
`yarn test:mockserver`

Runs the `bin/test-mockserver.js` script to start a mock server based on the OpenAPI specification. This is useful for testing API clients and integrations without needing a live CAPI environment.

Expand Down
14 changes: 7 additions & 7 deletions apis/cf/latest/components/schemas/AppCredentialBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ properties:
type: object
properties:
app:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
service_instance:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the credential binding
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
details:
$ref: './link.yaml'
$ref: './Link.yaml'
app:
$ref: './link.yaml'
$ref: './Link.yaml'
service_instance:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
2 changes: 1 addition & 1 deletion apis/cf/latest/components/schemas/BaseSchema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ properties:
links:
type: object
additionalProperties:
$ref: './link.yaml'
$ref: './Link.yaml'
description: |
A resource represents an individual object within the system, such as an app or a service. It is represented as a JSON object.
A resource consists of several required resource fields and other attributes specific to the resource.
Expand Down
2 changes: 1 addition & 1 deletion apis/cf/latest/components/schemas/Errors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ properties:
errors:
type: array
items:
$ref: './error.yaml'
$ref: './Error.yaml'
description: |
An error response will always return a list of error objects. Errors appear on the job resource for asynchronous operations.
Clients should use the code and title fields for programmatically handling specific errors. The message in the detail field is subject to change over time.
10 changes: 5 additions & 5 deletions apis/cf/latest/components/schemas/KeyCredentialBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ properties:
type: object
properties:
service_instance:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the credential binding
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
details:
$ref: './link.yaml'
$ref: './Link.yaml'
service_instance:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
12 changes: 6 additions & 6 deletions apis/cf/latest/components/schemas/Links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ type: object
description: Links provide URLs to relationships and actions for a resource. Links are represented as a JSON object and always contain a self link.
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
first:
$ref: './link.yaml'
$ref: './Link.yaml'
last:
$ref: './link.yaml'
$ref: './Link.yaml'
next:
$ref: './link.yaml'
$ref: './Link.yaml'
previous:
$ref: './link.yaml'
$ref: './Link.yaml'
additionalProperties:
$ref: './link.yaml'
$ref: './Link.yaml'
18 changes: 9 additions & 9 deletions apis/cf/latest/components/schemas/ManagedServiceInstance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,27 @@ properties:
type: object
properties:
space:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
service_plan:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the service instance
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
space:
$ref: './link.yaml'
$ref: './Link.yaml'
service_plan:
$ref: './link.yaml'
$ref: './Link.yaml'
parameters:
$ref: './link.yaml'
$ref: './Link.yaml'
service_credential_bindings:
$ref: './link.yaml'
$ref: './Link.yaml'
service_route_bindings:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ properties:
type: object
properties:
service_plan:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the service instance
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
description: Schema for updating a managed service instance
8 changes: 4 additions & 4 deletions apis/cf/latest/components/schemas/Pagination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ properties:
description: The total number of pages available
first:
allOf:
- $ref: './link.yaml'
- $ref: './Link.yaml'
- description: The first page of results
last:
allOf:
- $ref: './link.yaml'
- $ref: './Link.yaml'
- description: The last page of results
next:
allOf:
- $ref: './link.yaml'
- $ref: './Link.yaml'
- description: The next page of results
previous:
allOf:
- $ref: './link.yaml'
- $ref: './Link.yaml'
- description: The previous page of results
description: |
Pagination is a technique used to divide a large set of results into smaller, more manageable sets. This allows clients to retrieve results in smaller chunks, reducing the amount of data transferred and improving performance.
Expand Down
2 changes: 1 addition & 1 deletion apis/cf/latest/components/schemas/RelationshipToMany.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ properties:
data:
type: array
items:
$ref: './relationship.yaml'
$ref: './Relationship.yaml'
description: |
Some relationships relate a resource to several other resources. For example, an isolation segment can be entitled to multiple organizations.
2 changes: 1 addition & 1 deletion apis/cf/latest/components/schemas/RelationshipToOne.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type: object
properties:
data:
$ref: './relationship.yaml'
$ref: './Relationship.yaml'
description: |
Some relationships relate a resource to exactly one other resource. For example an app can belong to only one space.
12 changes: 6 additions & 6 deletions apis/cf/latest/components/schemas/SecurityGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ properties:
data:
type: array
items:
$ref: './relationship.yaml'
$ref: './Relationship.yaml'
description: Spaces where this security group is applied to running apps
staging_spaces:
type: object
properties:
data:
type: array
items:
$ref: './relationship.yaml'
$ref: './Relationship.yaml'
description: Spaces where this security group is applied to staging apps
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
running_spaces:
$ref: './link.yaml'
$ref: './Link.yaml'
staging_spaces:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
10 changes: 5 additions & 5 deletions apis/cf/latest/components/schemas/ServiceBroker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ properties:
type: object
properties:
space:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the service broker
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
space:
$ref: './link.yaml'
$ref: './Link.yaml'
service_offerings:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
12 changes: 6 additions & 6 deletions apis/cf/latest/components/schemas/ServiceRouteBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ properties:
type: object
properties:
route:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
service_instance:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the service route binding
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
route:
$ref: './link.yaml'
$ref: './Link.yaml'
service_instance:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
8 changes: 4 additions & 4 deletions apis/cf/latest/components/schemas/Sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ properties:
type: object
properties:
app:
$ref: './relationshipToOne.yaml'
$ref: './RelationshipToOne.yaml'
description: Relationships for the sidecar
links:
type: object
properties:
self:
$ref: './link.yaml'
$ref: './Link.yaml'
app:
$ref: './link.yaml'
$ref: './Link.yaml'
metadata:
$ref: './metadata.yaml'
$ref: './Metadata.yaml'
required:
- guid
- created_at
Expand Down
Loading