Skip to content
Closed
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
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Install TypeSpec compiler
run: npm install -g @typespec/compiler@1.11

- name: Install Spectral CLI
run: npm install -g @stoplight/spectral-cli

- name: Build all schemas
run: |
./build-schema.sh core
./build-schema.sh core --swagger
./build-schema.sh gcp
./build-schema.sh gcp --swagger

- name: Check schema consistency
run: |
if ! git diff --exit-code schemas/; then
echo "Committed schemas are out of sync with TypeSpec sources."
echo "Run './build-schema.sh core --swagger && ./build-schema.sh gcp --swagger' and commit the results."
exit 1
fi

- name: Lint OpenAPI schemas
run: |
spectral lint schemas/core/openapi.yaml schemas/gcp/openapi.yaml --format github-actions

- name: Check version bump
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
LATEST=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null | sed 's/^v//' || echo "")
Comment on lines +56 to +57
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Harden version extraction before enforcing the bump gate.

At Line 52, the parsed version is not validated. If parsing returns empty/unexpected output, the version-check logic can produce false passes. Fail fast when CURRENT is empty.

Proposed fix
-          CURRENT=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
+          CURRENT=$(sed -nE 's/.*version:[[:space:]]*"([^"]+)".*/\1/p' main.tsp | head -n1)
+          if [ -z "$CURRENT" ]; then
+            echo "Failed to extract version from main.tsp"
+            exit 1
+          fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
CURRENT=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
LATEST=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null | sed 's/^v//' || echo "")
CURRENT=$(sed -nE 's/.*version:[[:space:]]*"([^"]+)".*/\1/p' main.tsp | head -n1)
if [ -z "$CURRENT" ]; then
echo "Failed to extract version from main.tsp"
exit 1
fi
LATEST=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null | sed 's/^v//' || echo "")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 52 - 53, The CURRENT version
extraction (variable CURRENT from the grep on main.tsp) isn't validated; add a
fail-fast check immediately after computing CURRENT to detect empty or invalid
output and exit non‑zero with a clear message. In practice, after the CURRENT
assignment in the CI script, test if CURRENT is empty or does not match a simple
semver regex and if so print an error like "Failed to parse current version from
main.tsp: $CURRENT" and exit 1 so the bump gate cannot proceed on
malformed/empty values.

if [ -z "$LATEST" ]; then
echo "No previous releases found — version check skipped"
exit 0
fi
Comment on lines +57 to +61
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

# Check if the workflow file exists and examine lines 57-61
if [ -f .github/workflows/ci.yml ]; then
  echo "=== File exists. Checking lines 57-61 ==="
  sed -n '57,61p' .github/workflows/ci.yml
  echo ""
  echo "=== Full context (lines 50-70) ==="
  sed -n '50,70p' .github/workflows/ci.yml
else
  echo ".github/workflows/ci.yml does not exist"
  # Try to find any CI workflow file
  find . -name "ci.yml" -o -name "ci.yaml" 2>/dev/null | head -10
fi

Repository: openshift-hyperfleet/hyperfleet-api-spec

Length of output: 1201


Fail closed when release lookup fails in the version gate.

At line 57, errors from the release lookup are suppressed with 2>/dev/null, and combined with the || echo "" fallback, any command failure results in an empty LATEST value. This conflates two scenarios: no releases existing (legitimate for initial releases) and transient GitHub/API/auth failures. Both are treated identically—as "no releases"—causing the version check to be silently skipped during failures.

Suggested fix
-          LATEST=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null | sed 's/^v//' || echo "")
-          if [ -z "$LATEST" ]; then
+          if ! LATEST_RAW=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null); then
+            echo "Failed to query latest release tag"
+            exit 1
+          fi
+          LATEST="${LATEST_RAW#v}"
+          if [ -z "$LATEST" ]; then
             echo "No previous releases found — version check skipped"
             exit 0
           fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 57 - 61, The current LATEST assignment
hides failures by redirecting stderr and falling back to an empty string; change
the logic so the gh release lookup failure is detected and fails the job while
only an empty successful result is treated as "no releases." Run the gh release
list --limit 1 --json tagName --jq '.[0].tagName' (with the sed 's/^v//'
transform) without redirecting stderr, capture its exit status (the command
producing LATEST), and if the command exits non-zero, print the gh error output
and exit non-zero; only if the command succeeds but yields an empty string
should you echo "No previous releases found — version check skipped" and exit 0.
Ensure you reference and update the LATEST assignment and the subsequent
conditional that checks -z "$LATEST" so transient API/auth failures don't get
treated as "no releases."

if [ "$CURRENT" = "$LATEST" ]; then
echo "Version '$CURRENT' matches latest release tag 'v$LATEST' — bump the version in main.tsp before merging."
exit 1
fi
echo "Version bump OK: $LATEST → $CURRENT"
69 changes: 53 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,87 @@ name: Create Release

on:
push:
tags:
- 'v*'
branches:
- main-test
workflow_dispatch:
Comment on lines 4 to +7
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Trigger branch main-test will not run on main.

The PR is targeting main but the push trigger is restricted to main-test. After this merges, automatic releases will never fire on main pushes — only manual workflow_dispatch runs will publish. If main-test is a leftover from a draft/test cycle, switch it back to main (or include both) before merging.

Proposed fix
   push:
     branches:
-      - main-test
+      - main
   workflow_dispatch:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
push:
tags:
- 'v*'
branches:
- main-test
workflow_dispatch:
push:
branches:
- main
workflow_dispatch:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 4 - 7, The workflow's push
trigger currently limits releases to branch "main-test" so pushes to main won't
auto-run; update the workflow's push.branches value under the "push:" trigger to
include "main" (or replace "main-test" with "main", or list both "main" and
"main-test") so that automatic runs fire on pushes to main, leaving
"workflow_dispatch" intact for manual runs; edit the "push:" -> "branches:"
block in the release workflow to make this change.


jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '20'

- name: Install dependencies
run: npm install
run: npm ci

- name: Install tsp
run: npm install -g @typespec/compiler@1.6
- name: Install TypeSpec compiler
run: npm install -g @typespec/compiler@1.11

- name: Build Core schema
run: ./build-schema.sh core
- name: Extract version
id: version
run: |
VERSION=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
Comment on lines +35 to +37
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate extracted release version before deriving the tag.

At Line 34, the workflow assumes extraction always succeeds. If it fails, you can emit v as tag and corrupt release flow. Add an explicit non-empty validation.

Proposed fix
-          VERSION=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
+          VERSION=$(sed -nE 's/.*version:[[:space:]]*"([^"]+)".*/\1/p' main.tsp | head -n1)
+          if [ -z "$VERSION" ]; then
+            echo "Failed to extract version from main.tsp"
+            exit 1
+          fi
           echo "version=$VERSION" >> "$GITHUB_OUTPUT"
           echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
VERSION=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
VERSION=$(sed -nE 's/.*version:[[:space:]]*"([^"]+)".*/\1/p' main.tsp | head -n1)
if [ -z "$VERSION" ]; then
echo "Failed to extract version from main.tsp"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 34 - 36, The workflow currently
assumes the grep extraction into the VERSION variable succeeds; validate that
VERSION is non-empty after VERSION=$(grep -oP '(?<=version: ")[^"]+' main.tsp)
and before writing to GITHUB_OUTPUT, and if it is empty emit a clear error (use
echo to STDERR or fail the job) and exit non-zero to prevent writing "tag=v" and
corrupting the release; reference the VERSION variable and the subsequent echo
"tag=v$VERSION" >> "$GITHUB_OUTPUT" locations to add this guard and fail-fast
behavior.


- name: Build GCP schema
run: ./build-schema.sh gcp
- name: Check if release already exists
id: check_tag
run: |
git fetch --tags
if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
echo "Tag ${{ steps.version.outputs.tag }} already exists — skipping release"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
Comment on lines +39 to +48
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/release.yml | sed -n '30,85p'

Repository: openshift-hyperfleet/hyperfleet-api-spec

Length of output: 2524


Tag-based skip logic prevents release recovery after partial failures.

At line 42, the workflow checks tag existence using git rev-parse and sets skip=true if the tag exists. This blocks all downstream steps—including release creation at line 75—on subsequent runs. If the tag is pushed successfully (line 71) but release publication fails, reruns cannot recover because the tag already exists and the release creation step remains skipped.

Suggested fix
-      - name: Check if release already exists
-        id: check_tag
+      - name: Check if release already exists
+        id: check_release
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
-          git fetch --tags
-          if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
-            echo "Tag ${{ steps.version.outputs.tag }} already exists — skipping release"
+          if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
+            echo "Release ${{ steps.version.outputs.tag }} already exists — skipping release"
             echo "skip=true" >> "$GITHUB_OUTPUT"
           else
             echo "skip=false" >> "$GITHUB_OUTPUT"
           fi

-      - name: Build all schemas
-        if: steps.check_tag.outputs.skip == 'false'
+      - name: Build all schemas
+        if: steps.check_release.outputs.skip == 'false'

-      - name: Prepare release assets
-        if: steps.check_tag.outputs.skip == 'false'
+      - name: Prepare release assets
+        if: steps.check_release.outputs.skip == 'false'

-      - name: Create release tag
-        if: steps.check_tag.outputs.skip == 'false'
+      - name: Create release tag
+        if: steps.check_release.outputs.skip == 'false'
         run: |
           git config user.name "github-actions[bot]"
           git config user.email "github-actions[bot]@users.noreply.github.com"
-          git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
-          git push origin "${{ steps.version.outputs.tag }}"
+          git fetch --tags
+          if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
+            echo "Tag already exists; continuing to release creation."
+          else
+            git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
+            git push origin "${{ steps.version.outputs.tag }}"
+          fi

-      - name: Create GitHub Release
-        if: steps.check_tag.outputs.skip == 'false'
+      - name: Create GitHub Release
+        if: steps.check_release.outputs.skip == 'false'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 38 - 47, The current check in the
step with id check_tag uses git rev-parse on steps.version.outputs.tag and sets
skip=true if the tag exists, which prevents creating a release on retries when
the tag was pushed but the release step failed; change the logic so it only
skips when a GitHub release for that tag already exists (not merely the git
tag). Replace the git rev-parse branch in the "Check if release already exists"
step to query the GitHub Releases API (using curl with GITHUB_TOKEN or the gh
CLI) to check for an existing release for steps.version.outputs.tag and set
skip=true only if the API returns a release for that tag (otherwise set
skip=false) so reruns can recover by creating the missing release. Ensure you
reference the same step id (check_tag) and the tag value
steps.version.outputs.tag when implementing the API check.


- name: Build all schemas
if: steps.check_tag.outputs.skip == 'false'
run: |
./build-schema.sh core
./build-schema.sh core --swagger
./build-schema.sh gcp
./build-schema.sh gcp --swagger

- name: Prepare release assets
if: steps.check_tag.outputs.skip == 'false'
run: |
cp schemas/core/openapi.yaml core-openapi.yaml
cp schemas/core/swagger.yaml core-swagger.yaml
cp schemas/gcp/openapi.yaml gcp-openapi.yaml
cp schemas/gcp/swagger.yaml gcp-swagger.yaml

- name: Create release tag
if: steps.check_tag.outputs.skip == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
git push origin "${{ steps.version.outputs.tag }}"

- name: Create Release
- name: Create GitHub Release
if: steps.check_tag.outputs.skip == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
generate_release_notes: true
draft: false
prerelease: false
files: |
core-openapi.yaml
core-swagger.yaml
gcp-openapi.yaml
draft: false
prerelease: false
generate_release_notes: true
gcp-swagger.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas"]
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/openshift-hyperfleet/hyperfleet-api-spec

go 1.23
2 changes: 1 addition & 1 deletion models/common/model.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ model Error {
detail?: string;

/** URI reference for this specific occurrence */
@format("uri")
@format("uri-reference")
@example("/api/hyperfleet/v1/clusters")
instance?: string;

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion schemas/core/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,326 +16,326 @@
tags: []
paths:
/api/hyperfleet/v1/clusters:
get:
operationId: getClusters
summary: List clusters
parameters:
- $ref: '#/components/parameters/SearchParams'
- $ref: '#/components/parameters/QueryParams.page'
- $ref: '#/components/parameters/QueryParams.pageSize'
- $ref: '#/components/parameters/QueryParams.orderBy'
- $ref: '#/components/parameters/QueryParams.order'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ClusterList'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []

Check warning on line 44 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.

Check warning on line 44 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-description

Operation "description" must be present and non-empty string.
post:
operationId: postCluster
summary: Create cluster
description: |-
Create a new cluster resource.

**Note**: The `status` object in the response is read-only and computed by the service.
It is NOT part of the request body. Initially,
status.conditions will include mandatory "Available", "Ready" and "Reconciled" conditions.
parameters: []
responses:
'201':
description: The request has succeeded and a new resource has been created as a result.
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ClusterCreateRequest'
security:
- BearerAuth: []

Check warning on line 77 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
/api/hyperfleet/v1/clusters/{cluster_id}:
get:
operationId: getClusterById
summary: Get cluster by ID
parameters:
- $ref: '#/components/parameters/SearchParams'
- name: cluster_id
in: path
required: true
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []

Check warning on line 105 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.

Check warning on line 105 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-description

Operation "description" must be present and non-empty string.
patch:
operationId: patchClusterById
summary: Patch cluster by ID
description: Patch a specific cluster by ID
parameters:
- name: cluster_id
in: path
required: true
description: Cluster ID
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'400':
description: The server could not understand the request due to invalid syntax.
'404':
description: The server cannot find the requested resource.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ClusterPatchRequest'
security:
- BearerAuth: []
delete:
operationId: deleteClusterById

Check warning on line 143 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
summary: Request cluster deletion
description: |-
Marks the cluster for deletion by setting deleted_time to the current time, cascades to its nodepools.
The cluster remains in the database until it is fully deleted.
Returns the updated cluster with generation incremented.
parameters:
- name: cluster_id
in: path
required: true
schema:
type: string
responses:
'202':
description: The request has been accepted for processing, but processing has not yet completed.
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
example:
kind: Cluster
id: 019466a0-8f8e-7abc-9def-0123456789ab
href: https://api.hyperfleet.com/v1/clusters/019466a0-8f8e-7abc-9def-0123456789ab
name: cluster-123
labels:
environment: production
team: platform
spec: {}
generation: 2
status:
conditions:
- type: Ready
status: 'True'
reason: All adapters reported Ready True for the current generation
message: All adapters reported Ready True for the current generation
observed_generation: 2
created_time: '2021-01-01T10:00:00Z'
last_updated_time: '2021-01-01T10:00:00Z'
last_transition_time: '2021-01-01T10:00:00Z'
- type: Reconciled
status: 'True'
reason: All required adapters reported Available=True or Finalized=True at the current generation
message: All required adapters reported Available=True or Finalized=True at the current generation
observed_generation: 2
created_time: '2021-01-01T10:00:00Z'
last_updated_time: '2021-01-01T10:00:00Z'
last_transition_time: '2021-01-01T10:00:00Z'
- type: Available
status: 'True'
reason: All adapters reported Available True for the same generation
message: All adapters reported Available True for the same generation
observed_generation: 2
created_time: '2021-01-01T10:00:00Z'
last_updated_time: '2021-01-01T10:00:00Z'
last_transition_time: '2021-01-01T10:00:00Z'
- type: Adapter1Successful
status: 'True'
reason: This adapter1 is available
message: This adapter1 is available
observed_generation: 2
created_time: '2021-01-01T10:00:00Z'
last_updated_time: '2021-01-01T10:00:00Z'
last_transition_time: '2021-01-01T10:00:00Z'
- type: Adapter2Successful
status: 'True'
reason: This adapter2 is available
message: This adapter2 is available
observed_generation: 2
created_time: '2021-01-01T10:01:00Z'
last_updated_time: '2021-01-01T10:01:00Z'
last_transition_time: '2021-01-01T10:01:00Z'
created_time: '2021-01-01T00:00:00Z'
updated_time: '2021-01-01T10:02:00Z'
deleted_time: '2021-01-01T10:05:00Z'
created_by: user-123@example.com
updated_by: user-123@example.com
deleted_by: user-123@example.com
'400':
description: The server could not understand the request due to invalid syntax.
'404':
description: The server cannot find the requested resource.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}/nodepools:
get:

Check warning on line 233 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
operationId: getNodePoolsByClusterId
summary: List all nodepools for cluster
description: Returns the list of all nodepools for a cluster
parameters:
- name: cluster_id
in: path
required: true
description: Cluster ID
schema:
type: string
- $ref: '#/components/parameters/SearchParams'
- $ref: '#/components/parameters/QueryParams.page'
- $ref: '#/components/parameters/QueryParams.pageSize'
- $ref: '#/components/parameters/QueryParams.orderBy'
- $ref: '#/components/parameters/QueryParams.order'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/NodePoolList'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
post:
operationId: createNodePool

Check warning on line 267 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
summary: Create nodepool
description: Create a NodePool for a cluster
parameters:
- name: cluster_id
in: path
required: true
description: Cluster ID
schema:
type: string
responses:
'201':
description: The request has succeeded and a new resource has been created as a result.
content:
application/json:
schema:
$ref: '#/components/schemas/NodePoolCreateResponse'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NodePoolCreateRequest'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}/nodepools/{nodepool_id}:
get:
operationId: getNodePoolById
summary: Get nodepool by ID

Check warning on line 303 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
description: Returns specific nodepool
parameters:
- name: cluster_id
in: path
required: true
description: Cluster ID
schema:
type: string
- name: nodepool_id
in: path
required: true
description: NodePool ID
schema:
type: string
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/NodePool'
'400':
description: The server could not understand the request due to invalid syntax.
default:
description: An unexpected error response.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
delete:
operationId: deleteNodePoolById
summary: Request nodepool deletion
description: |-

Check warning on line 338 in schemas/core/openapi.yaml

View workflow job for this annotation

GitHub Actions / validate

operation-tags

Operation must have non-empty "tags" array.
Marks the nodepool for deletion by setting deleted_time and deleted_by. Does not affect the parent cluster.
Returns the updated nodepool with generation incremented.
parameters:
Expand Down Expand Up @@ -1317,7 +1317,7 @@
example: The cluster name field is required
instance:
type: string
format: uri
format: uri-reference
description: URI reference for this specific occurrence
example: /api/hyperfleet/v1/clusters
code:
Expand Down
2 changes: 1 addition & 1 deletion schemas/core/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ definitions:
instance:
description: URI reference for this specific occurrence
example: /api/hyperfleet/v1/clusters
format: uri
format: uri-reference
type: string
status:
description: HTTP status code
Expand Down
2 changes: 1 addition & 1 deletion schemas/gcp/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ components:
example: The cluster name field is required
instance:
type: string
format: uri
format: uri-reference
description: URI reference for this specific occurrence
example: /api/hyperfleet/v1/clusters
code:
Expand Down
2 changes: 1 addition & 1 deletion schemas/gcp/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ definitions:
instance:
description: URI reference for this specific occurrence
example: /api/hyperfleet/v1/clusters
format: uri
format: uri-reference
type: string
status:
description: HTTP status code
Expand Down
14 changes: 14 additions & 0 deletions schemas/schemas.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Package schemas exposes the generated HyperFleet OpenAPI schema files as an embedded filesystem.
// Consumers can import this package to access versioned schema content without vendoring local copies.
//
// Usage:
//
// import specschemas "github.com/openshift-hyperfleet/hyperfleet-api-spec/schemas"
//
// data, err := specschemas.FS.ReadFile("gcp/openapi.yaml")
package schemas

import "embed"

//go:embed core/openapi.yaml core/swagger.yaml gcp/openapi.yaml gcp/swagger.yaml
var FS embed.FS