Skip to content

fix(openapi): Fix codegen artifacts in schemas #322

fix(openapi): Fix codegen artifacts in schemas

fix(openapi): Fix codegen artifacts in schemas #322

Workflow file for this run

name: OpenAPI checks
on:
pull_request:
push:
branches:
- master
jobs:
lint:
name: Lint specification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
cache-dependency-path: "package-lock.json"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: npm ci --force
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Lint with Redocly
run: npm run openapi:lint:redocly -- --format=github-actions
- name: Lint with Spectral
run: npm run openapi:lint:spectral -- --format=github-actions
- name: Lint YAML style
run: npm run openapi:lint:yaml
build:
name: Build bundled specification
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
cache-dependency-path: "package-lock.json"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: npm ci --force
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build bundles
run: npm run openapi:build
- name: Upload bundles
uses: actions/upload-artifact@v6
with:
name: openapi-bundles
path: |
static/api/openapi.json
static/api/openapi.yaml
retention-days: 1
validate:
name: Validate bundled specification
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
cache-dependency-path: "package-lock.json"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: npm ci --force
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Download bundles
uses: actions/download-artifact@v7
with:
name: openapi-bundles
path: static/api/
- name: Validate YAML bundle
run: npx redocly lint static/api/openapi.yaml
- name: Validate JSON bundle
run: npx redocly lint static/api/openapi.json
- name: Check bundle sizes
run: |
JSON_SIZE=$(stat -f%z static/api/openapi.json 2>/dev/null || stat -c%s static/api/openapi.json)
YAML_SIZE=$(stat -f%z static/api/openapi.yaml 2>/dev/null || stat -c%s static/api/openapi.yaml)
echo "Bundle sizes:"
echo " JSON: $JSON_SIZE bytes"
echo " YAML: $YAML_SIZE bytes"
if [ "$JSON_SIZE" -lt 1000 ] || [ "$YAML_SIZE" -lt 1000 ]; then
echo "Error: Bundle files are suspiciously small"
exit 1
fi
echo "✓ Bundles have valid sizes"