Skip to content

chore: add Spectral lint to lint:openapi script#332

Merged
pengying merged 1 commit intomainfrom
package.json
Apr 10, 2026
Merged

chore: add Spectral lint to lint:openapi script#332
pengying merged 1 commit intomainfrom
package.json

Conversation

@pengying
Copy link
Copy Markdown
Contributor

Summary

  • Adds npx spectral lint openapi.yaml to the lint:openapi script in package.json
  • Runs after Redocly bundle and lint, before copying to mintlify
  • Uses existing .spectral.yaml rules (naming conventions, discriminators, inline schemas, pagination, etc.)

Test plan

  • npm run lint:openapi runs Spectral successfully
  • Verify CI picks up the updated lint script

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment Apr 10, 2026 10:04pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR wires Spectral into the lint:openapi npm script (with --fail-severity=error) and adds .spectral.yaml to CI path triggers. To satisfy the newly-enforced inline-schema rules, all 14+ inline response schemas across openapi/paths/ are extracted into dedicated *ListResponse.yaml component files, and resolved: false is added to both inline-schema Spectral rules so they operate on the raw YAML rather than the resolved bundle.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 documentation nits with no runtime impact.

The core change (Spectral integration) is straightforward and correct. Schema extractions faithfully preserve the original inline definitions. The only issue is a copy-paste error in a description string inside InternalAccountListResponse.yaml, which is a P2 style concern with no functional effect.

openapi/components/schemas/customers/InternalAccountListResponse.yaml — minor description copy-paste error on the totalCount field.

Important Files Changed

Filename Overview
package.json Adds npx spectral lint openapi.yaml --fail-severity=error between the Redocly lint step and the final copy; correct and consistent with the Makefile target.
.spectral.yaml Adds resolved: false to no-inline-request-schema and no-inline-response-schema rules so Spectral checks raw YAML without first resolving $refs, eliminating false positives.
.github/workflows/lint.yml Correctly adds .spectral.yaml to the path triggers so changes to Spectral rules also fire the lint CI job.
openapi/components/schemas/customers/InternalAccountListResponse.yaml New list-response schema extracted from inline path definition; totalCount description incorrectly says "customers" instead of "internal accounts".
openapi/components/schemas/receiver/ReceiverExternalAccountLookupResponse.yaml Faithfully extracts the allOf + accountId extension that was previously inline in the path file.
openapi/components/schemas/customers/PlatformInternalAccountListResponse.yaml Slim list-response (data-only, no pagination fields) matching the original platform endpoint's inline schema.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[npm run lint:openapi] --> B[prelint:openapi\nbuild:openapi]
    B --> C[Redocly bundle\nopenapi/ → openapi.yaml]
    C --> D[cp openapi.yaml\nmintlify/openapi.yaml]
    A --> E[lint:openapi script]
    E --> F[Redocly bundle again\nopenapi/ → openapi.yaml]
    F --> G[Redocly lint\nopenapi.yaml]
    G --> H[NEW: Spectral lint\nopenapi.yaml --fail-severity=error]
    H --> I[cp openapi.yaml\nmintlify/openapi.yaml]
    H -->|fail| J[❌ Exit non-zero]
    I --> K[✅ Done]
Loading

Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/components/schemas/customers/InternalAccountListResponse.yaml
Line: 21-23

Comment:
**Copy-paste error in `totalCount` description**

The description reads "Total number of *customers* matching the criteria" but this schema represents internal accounts, not customers. This was copied verbatim from `CustomerListResponse.yaml`.

```suggestion
    description: >-
      Total number of internal accounts matching the criteria (excluding
      pagination)
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (4): Last reviewed commit: "chore: add Spectral lint to lint:openapi..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

chore(internal): regenerate SDK with no functional changes

openapi

chore(internal): extract inline response schemas into named components

python

chore(internal): regenerate SDK with no functional changes

typescript

chore(internal): regenerate SDK with no functional changes
⚠️ grid-openapi studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗

⚠️ grid-kotlin studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

⚠️ grid-python studio · code

Your SDK build had a failure in the lint CI job, which is a regression from the base state.
generate ❗build ✅lint ❗test ✅

pip install https://pkg.stainless.com/s/grid-python/8fd60072b19b28f586e118e226cb3b2f5cfc67a3/grid-0.0.1-py3-none-any.whl
⚠️ grid-typescript studio · code

Your SDK build had a failure in the lint CI job, which is a regression from the base state.
generate ❗build ✅lint ❗test ✅

npm install https://pkg.stainless.com/s/grid-typescript/ee3c6bb12a943064c4a1ad9c82131571f49ffba2/dist.tar.gz

This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-04-10 22:22:59 UTC

Runs Spectral's OpenAPI linter (custom rules in .spectral.yaml) as part
of the lint:openapi pipeline, after Redocly bundle and lint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pengying pengying merged commit 49e7450 into main Apr 10, 2026
10 checks passed
@pengying pengying deleted the package.json branch April 10, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants