Add Spectral lint CI gate for openapi.yaml#13410
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Adds a blocking Spectral lint check that runs on PRs touching openapi.yaml or the ruleset itself. The ruleset mirrors the one used for other Comfy-Org service specs: spectral:oas plus conventions for snake_case properties, camelCase operationIds, and response/schema shape. Gate runs at --fail-severity=error, which the spec currently passes with zero errors (a small number of non-blocking warnings/hints remain for WebSocket 101 responses, the existing loose error schema, and two snake_case wire fields).
f0f5cc9 to
14ada4d
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds automated OpenAPI linting: a GitHub Actions workflow that runs on pull requests touching `openapi.yaml`, `.spectral.yaml`, or the workflow file. The job checks out the repo, sets up Node.js 20, installs `@stoplight/spectral-cli@6`, and runs Spectral against `openapi.yaml`, failing on error-severity findings. Also adds `.spectral.yaml` which extends `spectral:oas`, adjusts severities, and defines custom rules for property naming, operationId format, response schemas, path parameter descriptions, and component schema descriptions. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Review rate limit: 1/5 review remaining, refill in 39 minutes and 55 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/openapi-lint.yml:
- Around line 3-13: Add an explicit least-privilege permissions block to the
workflow: under the top-level workflow config (where "on: pull_request" is
declared) add a permissions stanza setting "contents: read" so the "spectral"
job runs with read-only token scope; update the workflow to include the new
permissions entry rather than relying on repo/org defaults.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9db5bd20-688b-4b89-a797-d3cefbaf1231
📒 Files selected for processing (2)
.github/workflows/openapi-lint.yml.spectral.yaml
…kflow Per CodeRabbit review on #13410. The job only checks out the repo and runs Spectral, so contents:read is sufficient and avoids inheriting any permissive repo/org default token scope. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…kflow Per CodeRabbit review on #13410. The job only checks out the repo and runs Spectral, so contents:read is sufficient and avoids inheriting any permissive repo/org default token scope.
7ae5341 to
2cf262f
Compare
Summary
.spectral.yamlat repo root, mirroring the ruleset used for other Comfy-Org service specs (spectral:oasplus custom rules for snake_case property names, camelCase operationIds, error-response shape, path-param descriptions, and schema descriptions)..github/workflows/openapi-lint.yml— runs@stoplight/spectral-cli@6on PRs that touchopenapi.yamlor the ruleset, at--fail-severity=error. Blocking from day 1 (nocontinue-on-errortransitional period).masterautomatically once that PR merges.Current state of the spec
Running the ruleset locally against
openapi.yamlat the tip of this branch:Zero errors, so the gate passes. The 4 remaining findings are all known non-blocking items:
/wsGET —operation-success-response(WebSocket returns 101, no 2xx response)PromptErrorResponse— loose error-response schema (hint)ModelFile.pathIndex— snake_case warning on a wire fieldProgressTextWsMessage.nodeId— snake_case warning on a wire fieldThe two snake_case fields and the error shape are constrained by wire compatibility, and the
/wshandshake can't express a 101 in OpenAPI cleanly.Test plan
OpenAPI Lintjob on this PRopenapi.yaml/.spectral.yamlAPI Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms