-
Notifications
You must be signed in to change notification settings - Fork 3
feat: migrate to unified OpenAPI v4 specification #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f7dd569
37f3756
55d7900
f5122c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1,28 @@ | ||
|
|
||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| # Allows you to run this workflow manually from the Actions tab | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test_job: | ||
| validate: | ||
| name: Validate OpenAPI | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:22.04 | ||
| steps: | ||
| - name: Setup Env | ||
| run: apt-get update && apt-get install -y git npm | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 14 | ||
|
|
||
| - name: Setting GIT | ||
| run: git config --global url."https://${{ secrets.GLOBAL_TOKEN }}:x-oauth-basic@github.com/aziontech".insteadOf "https://github.com/aziontech" | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Git config | ||
| run: git config --global --add safe.directory /__w/azionapi-openapi/azionapi-openapi | ||
| shell: bash | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: install openapi-linter | ||
| run: npm i -g @superfaceai/openapi-linter | ||
|
|
||
| #get all .yaml files which were added/modified | ||
| - name: Get changed files | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v35 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| files: | | ||
| **/*.yaml | ||
| files_ignore: | | ||
| spectral/.spectral*.yaml | ||
|
|
||
| - name: Run linter for changed files | ||
| run: | | ||
| for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
| oal lint $file -f yaml | ||
| done | ||
| node-version: '20' | ||
|
|
||
| - name: install redocly-cli | ||
| run: npm i -g @redocly/cli@1.0.0-beta.129 | ||
| - name: Install Redocly CLI | ||
| run: npm install -g @redocly/cli | ||
|
|
||
| - name: Run linter for changed files | ||
| run: | | ||
| for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
| redocly lint $file | ||
| done | ||
| - name: Validate OpenAPI v4 | ||
| run: redocly lint openapi.yaml | ||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | |||||||||||||||||||||||||||||
| name: Sync from azionapi-v4-openapi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| # Triggered by repository dispatch from azionapi-v4-openapi | |||||||||||||||||||||||||||||
| repository_dispatch: | |||||||||||||||||||||||||||||
| types: [sync-openapi-v4] | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # Manual trigger | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||||||||
| source_ref: | |||||||||||||||||||||||||||||
| description: 'Branch or tag from azionapi-v4-openapi to sync from' | |||||||||||||||||||||||||||||
| required: false | |||||||||||||||||||||||||||||
| default: 'main' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| sync: | |||||||||||||||||||||||||||||
| name: Sync OpenAPI v4 | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout azionapi-openapi | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| token: ${{ secrets.GLOBAL_TOKEN }} | |||||||||||||||||||||||||||||
| fetch-depth: 0 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Checkout azionapi-v4-openapi | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| repository: aziontech/azionapi-v4-openapi | |||||||||||||||||||||||||||||
| ref: ${{ github.event.inputs.source_ref || 'main' }} | |||||||||||||||||||||||||||||
| path: v4-source | |||||||||||||||||||||||||||||
| token: ${{ secrets.GLOBAL_TOKEN }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Sync openapi.yaml | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| cp v4-source/openapi.yaml openapi.yaml | |||||||||||||||||||||||||||||
| echo "Synced openapi.yaml from azionapi-v4-openapi" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Sync spectral rules | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| rm -rf spectral | |||||||||||||||||||||||||||||
| cp -r v4-source/spectral spectral | |||||||||||||||||||||||||||||
| echo "Synced spectral rules from azionapi-v4-openapi" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Cleanup | |||||||||||||||||||||||||||||
| run: rm -rf v4-source | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Check for changes | |||||||||||||||||||||||||||||
| id: changes | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| if git diff --quiet; then | |||||||||||||||||||||||||||||
| echo "has_changes=false" >> $GITHUB_OUTPUT | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| echo "has_changes=true" >> $GITHUB_OUTPUT | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Commit and push changes | |||||||||||||||||||||||||||||
| if: steps.changes.outputs.has_changes == 'true' | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| git config user.name "github-actions[bot]" | |||||||||||||||||||||||||||||
| git config user.email "github-actions[bot]@users.noreply.github.com" | |||||||||||||||||||||||||||||
| git add openapi.yaml spectral/ | |||||||||||||||||||||||||||||
| git commit -m "chore: sync openapi.yaml and spectral from azionapi-v4-openapi" | |||||||||||||||||||||||||||||
| git push | |||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+66
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 13 days ago To fix the problem, explicitly declare a The job performs checkouts and then commits and pushes back to the same repository. Committing and pushing require write access to repository contents, so we should grant Concretely:
permissions:
contents: write
Suggested changeset
1
.github/workflows/sync-v4.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,17 +3,34 @@ | |
|
|
||
| OpenAPI 3.0 specification for Azion APIs. | ||
|
|
||
| |YAML|DESCRIPTION| | ||
| |---|---| | ||
| |`credentials.yaml`|Credentials API, part of the Orchestration Architecture.| | ||
| |`domains.yaml`|Domains API enables you to retrieve, create, remove or update Domains used by Edge Applications.| | ||
| |`edgeapplications.yaml`|Edge Applications allows you to check, remove and/or update your existing settings, as well as creating new ones.| | ||
| |`edgefunctions.yaml`|Edge Functions API.| | ||
| |`edgenode.yaml`|Edge Node API, part of the Orchestration Architecture.| | ||
| |`idns.yaml`|Intelligent DNS API.| | ||
| |`realtimepurge.yaml`|Real-Time Purge API enables you to purge a cache entry before its TTL for Edge Caching or L2 Caching| | ||
| |`services.yaml`|Edge Services API, part of the Orchestration Architecture.| | ||
| |`waf.yaml`|WAF API -- WAF self-calibration enables you to create allowed rules that are meaningful to your application.| | ||
| ## 📄 OpenAPI Files | ||
|
|
||
| ### API v4 (Current) | ||
| - **[openapi.yaml](openapi.yaml)** - Complete Azion API v4 specification | ||
|
|
||
| ### API v3 (Legacy) | ||
| Legacy API specifications are available in the `v3/` directory for backward compatibility. | ||
|
|
||
| ## 🚀 Quick Start | ||
|
|
||
| ```bash | ||
| # View with Swagger UI | ||
| npx @redocly/cli preview-docs openapi.yaml | ||
|
|
||
| # Validate with Spectral | ||
| npx @stoplight/spectral-cli lint openapi.yaml --ruleset spectral/spectral.yaml | ||
|
|
||
| # Generate client SDKs | ||
| openapi-generator-cli generate -i openapi.yaml -g python -o ./client | ||
| ``` | ||
|
|
||
| ## 📚 Documentation | ||
|
|
||
| - **[Spectral Validation Rules](spectral/README.md)** - Comprehensive guide to all custom Spectral linting rules | ||
|
|
||
| ## 🔄 Synchronization | ||
|
|
||
| The `openapi.yaml` file is automatically synchronized from [azionapi-v4-openapi](https://github.com/aziontech/azionapi-v4-openapi) when changes are merged to the main branch. | ||
|
|
||
| ## License | ||
|
|
||
|
|
||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 13 days ago
In general, you fix this by explicitly specifying
permissionsfor the workflow or for individual jobs, granting only what is actually required. For this CI workflow, the job only reads repository contents, socontents: readat the workflow or job level is sufficient.The best minimal fix, without changing functionality, is to add a top-level
permissions:block right after the workflowname:declaration (around line 1–2) in.github/workflows/ci.yml. This block should setcontents: read, which is enough foractions/checkoutto work and for the linter to access files. No imports or additional methods are required because this is purely a YAML configuration change.