Thank you for your interest in contributing to the HyperFleet API specification! This document provides guidelines for contributing to the project.
- Node.js 20.x or later
- npm 11.6.2 or later (included in package.json packageManager)
- Git
- (Optional) Visual Studio Code with the TypeSpec extension
-
Clone the repository:
git clone https://github.com/openshift-hyperfleet/hyperfleet-api-spec.git cd hyperfleet-api-spec -
Install TypeSpec compiler globally:
npm install -g @typespec/compiler
-
Install project dependencies:
npm install
-
Verify your setup by building the schemas:
npm run build:core npm run build:gcp
hyperfleet-api-spec/
├── main.tsp # Main TypeSpec entry point
├── aliases.tsp # Active provider aliases (symlink)
├── aliases-core.tsp # Core provider aliases
├── aliases-gcp.tsp # GCP provider aliases
├── tspconfig.yaml # TypeSpec compiler configuration
├── build-schema.sh # Build script for OpenAPI generation
├── models/ # Shared models for all providers
│ ├── clusters/ # Cluster resource definitions
│ ├── nodepools/ # NodePool resource definitions
│ ├── statuses/ # Status resource definitions
│ └── common/ # Common types and models
├── models-core/ # Core provider-specific models
├── models-gcp/ # GCP provider-specific models
├── services/ # Service definitions
│ ├── clusters.tsp # Cluster endpoints
│ ├── nodepools.tsp # NodePool endpoints
│ ├── statuses.tsp # Status read endpoints (public)
│ └── statuses-internal.tsp # Status write endpoints (internal)
└── schemas/ # Generated OpenAPI outputs
├── core/
└── gcp/
Test your changes by building the OpenAPI schemas:
# Build individual variants
npm run build:core
npm run build:gcp
# Build with Swagger (OpenAPI 2.0) output
npm run build:core:swagger
npm run build:gcp:swagger
# Build all variants
npm run build:allAfter building, verify the generated schemas:
# Check that files were generated
ls -l schemas/core/openapi.yaml
ls -l schemas/gcp/openapi.yaml
# Review the generated OpenAPI for your changes
cat schemas/core/openapi.yamlIf using VS Code with the TypeSpec extension:
- The extension may show errors for non-active provider types (this is expected)
- Use "Emit from TypeSpec" command to compile
- The
build-schema.shscript always works regardless of extension errors
The VSCode extension has a nice feature when doing right click on the main.tsp and selecting "Preview API Documentation", it will display the Swagger rendered from the spec in a side panel.
-
Create the model file in the appropriate directory:
// models/newresource/model.tsp import "@typespec/http"; import "../common/model.tsp"; model NewResource { id: string; name: string; }
-
Import in
main.tspif needed -
Build and verify:
npm run build:core
-
Create or edit a service file in
services/:// services/newservice.tsp import "@typespec/http"; import "@typespec/openapi"; import "../models/common/model.tsp"; namespace HyperFleet; @route("/new-resource") interface NewService { @get list(): NewResource[] | Error; }
-
Import in
main.tsp:import "./services/newservice.tsp";
-
Build and verify:
npm run build:all
-
Create provider model directory:
mkdir -p models-aws/cluster
-
Define provider-specific models:
// models-aws/cluster/model.tsp model AWSClusterSpec { awsProperty1: string; awsProperty2: string; }
-
Create provider aliases file:
// aliases-aws.tsp import "./models-aws/cluster/model.tsp"; alias ClusterSpec = AWSClusterSpec;
-
Update
build-schema.shto support the new provider (it auto-detects) -
Build:
./build-schema.sh aws
The aliases.tsp symlink controls which provider is active:
# Work on Core API
ln -sf aliases-core.tsp aliases.tsp
# Work on GCP API
ln -sf aliases-gcp.tsp aliases.tspThe VS Code extension uses whichever provider aliases.tsp points to.
Please refer to the architecture repo commit standard
Examples:
feat: add NodePool autoscaling fields to GCP spec
fix: correct required fields in ClusterStatus model
docs: update README with new provider examples
refactor: consolidate common status fields
See RELEASING.md for detailed release instructions.
Quick summary:
- Build schemas:
npm run build:all - Commit changes
- Create tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z" - Push tag:
git push upstream vX.Y.Z - Create GitHub Release with
core-openapi.yamlandgcp-openapi.yamlassets
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Build and test:
npm run build:all - Commit with conventional commit message
- Push to your fork
- Create a Pull Request
- Address review feedback
- Wait for approval and merge
- Keep PRs focused on a single change
- Include schema outputs in commits when they change
- Update documentation if you change functionality
- Reference related issues in PR description
For broader HyperFleet architecture context and documentation standards, see the HyperFleet Architecture Repository.
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Tag issues appropriately (bug, enhancement, documentation, etc.)
Be respectful and constructive in all interactions. We aim to foster an inclusive and welcoming community.