How to Rate OpenAPI Schemas
January 30, 2026 Β· View on GitHub
Overview
Rate AI-generated OpenAPI schemas by comparing them against official published schemas. This helps you:
- Track generation quality
- Identify systematic gaps
- Improve prompts based on results
- Measure progress over time
Quick Start
-
Run the command, providing file paths, as exemplified:
/rate-openapi generated: generated-docs/2025-10-28-Claude-4-Sonnet-Cursor/session/session-openapi.json published: VTEX - Session Manager API.json -
Review the report saved to
ratings/directory.
π Scoring System
Rating Criteria
| Criterion | Weight | What it Measures |
|---|---|---|
| Endpoints Coverage | 20% | All endpoints present? |
| Parameters Completeness | 17% | All parameters correct? |
| Request Bodies Accuracy | 17% | Request schemas complete? |
| Response Schemas Accuracy | 16% | Response schemas complete? |
| Spectral Compliance | 20% | Passes quality/standards checks? |
| Schema Components | 5% | Components properly defined? |
| Metadata & Documentation | 5% | API info correct? |
Overall Score Formula
Score = (Endpoints Γ 0.20) + (Parameters Γ 0.17) + (Request Γ 0.17) +
(Response Γ 0.16) + (Spectral Γ 0.20) + (Components Γ 0.05) +
(Metadata Γ 0.05)
Grading Scale
| Score | Grade | Status | Action |
|---|---|---|---|
| 90-100 | A | β Excellent | Minor polish β Tech writing review |
| 80-89 | B | β Good | Fix critical β Tech writing review |
| 70-79 | C | β οΈ Fair | Major fixes β Tech writing review |
| 60-69 | D | β οΈ Poor | Significant rework needed |
| 0-59 | F | β Failing | Re-generate |
Important: All generated schemas require tech writing review before publication.
Target Metrics
| Metric | Target |
|---|---|
| Endpoints Coverage | β₯ 95% |
| Parameters Completeness | β₯ 90% |
| Request Bodies Accuracy | β₯ 85% |
| Response Schemas Accuracy | β₯ 85% |
| Spectral Compliance | β₯ 90% |
| Overall Score | β₯ 80 |
π Criteria summary
1. Endpoints Coverage (25%)
- β All paths + methods present
- β Missing endpoints
- β οΈ Extra/hallucinated endpoints
- π Path differences
2. Parameters Completeness (15%)
- β
Path parameters (e.g.,
{id},{accountName}) - β
Query parameters (e.g.,
?page=1&limit=10) - β
Header parameters (
Content-Type,Accept, etc.) - β
Correct types and
requiredstatus - π Parameter descriptions
3. Request Bodies Accuracy (15%)
- β All fields present
- β Correct data types
- β Nested objects complete
- β Array items defined
- π Examples at schema level
- π Field descriptions
4. Response Schemas Accuracy (15%)
- β All status codes (200, 201, 400, 401, 403, 404, 500)
- β Response body schemas complete
- β All response fields present
- β Nested objects complete
- π Examples at schema level
5. Spectral Compliance (25%)
- β No linting errors (descriptions, schemas, etc.)
- β Minimal warnings (best practices)
- β VTEX-specific rules compliance
- π Automated quality validation
- Score: 100 - (errorsΓ5 + warningsΓ2 + infoΓ0.5)
- Command:
/spectral {schema-file-name} - Weight: 25% (highest priority - equal to endpoints)
6. Schema Components (2%)
- β
Reusable schemas in
components - β
Proper
$refusage - β Parameter definitions
- β Security schemes
7. Metadata & Documentation (3%)
- β Title, description, version
- β Server configurations
- β Tags organization
- β Security schemes defined
Understanding Your Report
1. Overall Score
Quick overview showing total score and breakdown by criterion.
2. Detailed Findings
Each criterion section shows:
- Statistics (counts and percentages)
- Specific issues with examples
- Affected endpoints/fields
- Impact assessment (High/Medium/Low)
3. Top Issues
Prioritized list of critical problems to fix first.
4. Recommendations
- High Priority: Must fix
- Medium Priority: Should fix for quality
- Low Priority: Nice to have
Common Issues & Solutions
Low Endpoints Coverage (< 90%)
Causes:
- AI didn't explore entire codebase
- Non-standard routing patterns
- Controllers in unexpected locations
Solutions:
- Provide explicit list of controller files
- Review route configuration files
- Use more specific codebase search
Low Parameters Completeness (< 85%)
Causes:
- Parameters defined in attributes/decorators
- Implicit parameters (accountName, environment)
- Inherited parameters from base controllers
Solutions:
- Review controller base classes
- Check authentication middleware
- Review VTEX-specific conventions
Incomplete Response Schemas (< 80%)
Causes:
- Response types not explicitly defined
- Dynamic/runtime field generation
- Partial responses based on permissions
Solutions:
- Provide example API responses (Postman)
- Review response DTO classes
- Check for response mappers/transformers
Low Spectral Compliance (< 90%)
Causes:
- Empty or missing descriptions
- Missing permissions documentation
- Incorrect formatting
Solutions:
- Run
/spectralcommand for auto-fixes - Add meaningful descriptions
- Include "## Permissions" sections
- See Spectral Linting Guide
Example Report
# OpenAPI Schema Rating Report
**Generated**: generated-docs/2025-10-28-Claude-4-Sonnet-Cursor/session/session-openapi.json
**Published**: VTEX - Session Manager API.json
**Date**: 2025-10-28
## π Overall Score: 82/100 (Grade: B)
| Criteria | Score | Weighted |
| -------- | ----- | -------- |
| Endpoints | 85/100 | 21.25 |
| Parameters | 78/100 | 11.70 |
| Request Bodies | 80/100 | 12.00 |
| Response Schemas | 84/100 | 12.60 |
| Spectral | 85/100 | 21.25 |
| Components | 70/100 | 1.40 |
| Metadata | 95/100 | 2.85 |
| **Total** | | **83.05** |
## π Top 3 Critical Issues
1. **Missing Parameter**: accountName (8 endpoints)
- Impact: High
- Fix: Add to all path parameters
2. **Missing Response**: 404 Not Found (6 endpoints)
- Impact: High
- Fix: Define 404 error response schema
3. **Low Spectral Score**: 12 empty descriptions
- Impact: Medium
- Fix: Run `/spectral` for auto-fix
## β
What Was Done Well
- All major endpoints present (100% coverage)
- Request bodies comprehensive
- Security schemes correct
Additional Resources
- Command Reference:
.cursor/commands/rate-openapi.md - Configuration:
rating-config.json - Spectral Guide: spectral-linting.md
- System Summary: RATING-SYSTEM-SUMMARY.md