| name | review-api-endpoint |
| description | Use when reviewing PRs that add or modify API endpoints - verifying implementation completeness, test coverage, assertion patterns, and documentation updates |
Review API Endpoint
Overview
Systematic checklist for reviewing SDK endpoint implementations. Ensures all 4 required components exist: implementation, tests (5 types with correct assertions), WireMock mappings, and documentation. Critical: Verify implementation matches OpenAPI spec exactly.
When to Use
- Reviewing PR that adds new SDK endpoint
- Reviewing PR that modifies existing endpoint
- Code review for API integration work
- Verifying endpoint implementation follows SDK standards
GOLD STANDARD VERIFICATION: Compare implementation against tests/mock_api/reports/ during review. Tests should match these patterns exactly.
Required before review:
- OpenAPI spec (Smartsheet public API: https://developers.smartsheet.com/_spec/api/smartsheet/openapi.json OR user-provided spec path)
- WireMock mappings (Smartsheet SDK tests repo: https://github.com/smartsheet/smartsheet-sdk-tests OR user-provided local path)
Cannot approve without spec AND mappings verification.
Review Checklist
Work through each section systematically:
0. OpenAPI Spec Verification (MUST BE FIRST)
Required: OpenAPI spec URL or path
If any spec mismatch found: Request changes immediately - do not continue review until fixed.
0b. WireMock Mappings Verification (MUST BE SECOND)
Required: WireMock mappings location (GitHub repo or local path)
If any mapping missing or spec mismatch found: Request changes immediately - do not continue review.
0c. Breaking Change Detection (CRITICAL - MUST BE THIRD)
CRITICAL IMPORTANCE: Breaking changes in the public SDK contract break user code in production. This check is MANDATORY and NON-NEGOTIABLE.
Rule: Unless the PR author EXPLICITLY states "This PR contains breaking changes" with justification, ANY breaking change MUST be flagged and PR MUST be rejected.
What constitutes a breaking change:
Method Signature Changes (BREAKING):
Return Type Changes (BREAKING):
Behavior Changes (BREAKING):
Non-Breaking Changes (ALLOWED):
Review Process:
-
Check PR description first:
- Does it say "This PR contains breaking changes" OR "Breaking change:" OR "BREAKING:"?
- If YES: Verify justification is provided (major version bump, deprecation path, migration guide)
- If NO: Proceed to step 2
-
Compare old vs new signatures:
- Request git diff showing before/after method signatures
- Check EVERY change against breaking change list above
- Even ONE breaking change without explicit documentation = REQUEST CHANGES
-
If breaking change found without documentation:
- IMMEDIATELY REQUEST CHANGES - do not proceed with rest of review
- State: "This PR introduces breaking changes without explicit documentation"
- List each breaking change specifically
- Require either:
- Revert to backward-compatible design, OR
- Update PR description with "BREAKING CHANGE:" and full justification
-
If breaking change is documented:
- Verify justification is reasonable (not just "cleaner API")
- Verify migration path is documented
- Verify version bump strategy is mentioned (major version)
- If missing any of these: REQUEST CHANGES
Example Breaking Changes to Flag:
def get_sheet(self, sheet_id: int, include: List[str] = None)
def get_sheet(self, sheet_id: int)
def get_sheet(self, sheet_id: int, format: str = "json")
def get_sheet(self, sheet_id: int, format: str)
def get_sheet(self, sheet_id: int) -> Union[Sheet, Error]
def get_sheet(self, sheet_id: int) -> Sheet
Common Rationalizations to REJECT:
| Excuse | Reality | Response |
|---|
| "Users probably aren't using that parameter" | You don't know that | REQUEST CHANGES |
| "It's a minor change" | Minor to you ≠ minor to users | REQUEST CHANGES |
| "Tests pass" | Tests don't catch breaking changes to public API | REQUEST CHANGES |
| "OpenAPI spec changed" | SDK still breaks existing user code | REQUEST CHANGES (requires explicit BREAKING CHANGE note) |
| "Better API design" | Breaking user code is not better | REQUEST CHANGES or deprecation path required |
| "Will document in CHANGELOG" | PR description must state it FIRST | REQUEST CHANGES until PR description updated |
Red Flags - Breaking Change Not Documented:
These thoughts mean STOP and REQUEST CHANGES immediately:
- "The change makes sense" - Doesn't matter if it breaks users
- "Spec says it's required now" - Still breaks existing SDK users
- "Only affects edge cases" - Still a breaking change
- "Can be fixed in user code easily" - Still requires every user to update
- "Implementation is cleaner" - Not worth breaking users
The Rule (Repeat for Emphasis):
NO BREAKING CHANGES WITHOUT EXPLICIT PR DESCRIPTION STATING "BREAKING CHANGE:" + JUSTIFICATION
If you find a breaking change and PR description doesn't explicitly mention it: IMMEDIATE REQUEST CHANGES. DO NOT PROCEED WITH REVIEW.
1. Implementation Quality
File: smartsheet/{resource}.py
Reference: @ADVANCED.md "Resource Module Organization"
2. Test Coverage (5 Required Types)
File: tests/mock_api/{resource}/test_{method_name}.py
CRITICAL: All 5 test types MUST exist. Tests MUST strictly follow @TESTING.md standards. Check test file has all 5 functions.
GOLD STANDARD COMPARISON: Open tests/mock_api/reports/test_create_report.py (or any report test) side-by-side. Implementation should match these patterns exactly - same assertion style, same structure, same helper usage.
Test data must match OpenAPI spec:
Reference:
- @TESTING.md "Mock API Test Standards" (especially lines 136-141 for request body requirements)
- GOLD STANDARD: tests/mock_api/reports/ - compare PR tests against these patterns
3. Test Quality Issues
Common anti-patterns to catch:
4. WireMock Mappings
Repository: smartsheet-sdk-tests
Note: Cannot directly verify without checking external repo, but look for test scenario names:
If tests reference non-standard scenarios, flag for WireMock mapping verification.
5. Documentation Updates
File: docs-source/smartsheet_api.rst (or appropriate .rst file)
Reference: @CONTRIBUTING.md "Documentation" section and @ADVANCED.md for documentation requirements
6. Supporting Files
Quick Reference: Test Count by Endpoint Type
| Endpoint Type | Required Tests | Request Body Assertions |
|---|
| GET single | 4-5 (skip required if N/A) | No |
| GET list | 4-5 | No |
| POST | 5 | Yes - required |
| PUT | 5 | Yes - required |
| PATCH | 5 | Yes - required |
| DELETE | 5 | No |
Review Outcome Decision
Approve (Ready to Merge):
- OpenAPI spec verified and implementation matches exactly
- WireMock mappings verified
- Tests match gold standard patterns in tests/mock_api/reports/
- All 5 test types exist (or 4 if required_properties N/A)
- All assertions use whole-object pattern
- Tests strictly follow @TESTING.md standards - MANDATORY, no exceptions
- POST/PUT/PATCH include request body assertions
- Type safety checks present (isinstance for wrapper AND inner)
- Documentation updated
- No anti-patterns detected
Request Changes (MUST block merge - non-negotiable):
- No OpenAPI spec provided or not verified
- No WireMock mappings provided or not verified
- BREAKING CHANGE without explicit PR documentation (CRITICAL - see Breaking Change Detection section)
- Missing type definitions for new endpoint
- Python 3.8+ features used (must be 3.7 compatible)
- Implementation doesn't match spec (parameters, types, structure)
- Response/request schemas don't match spec
- Tests don't match gold standard patterns
- Missing any required test type
- Tests don't follow @TESTING.md standards
- Property-by-property assertions present
- Missing request body assertions (POST/PUT/PATCH)
- Incomplete type safety checks
- Documentation missing or incorrect
- WireMock scenario names suggest missing mappings
Comment/Question:
- Cannot verify WireMock mappings exist (external repo)
- Sphinx build not confirmed
- Minor style issues (but don't block if spec verified and tests complete)
Red Flags - Don't Approve Yet
These thoughts mean STOP - review is incomplete:
- "I don't need to check the spec" - Spec verification is MANDATORY
- "I don't need to check WireMock mappings" - Mappings verification is MANDATORY
- "I don't need to check for breaking changes" - Breaking change check is MANDATORY
- "Change looks reasonable so it's not breaking" - Must explicitly verify against breaking change list
- "PR doesn't mention breaking changes so there aren't any" - You must verify, not trust
- "Users probably aren't affected" - Any breaking change requires explicit documentation
- "It's just following the spec" - Spec changes can still break SDK users
- "I didn't compare to reports tests" - Gold standard comparison is MANDATORY
- "Tests look similar to reports" - Must match EXACTLY, not just similar
- "Implementation looks right" - Must verify against spec, not intuition
- "Spec roughly matches" - Must match EXACTLY, not roughly
- "Mappings probably exist" - Must verify, not assume
- "Tests pass, looks good" - Check assertion patterns, not just pass/fail
- "Has error tests" - Verify BOTH 4xx and 5xx exist
- "All 5 tests present" - Check quality, not just count
- "Implementation works" - Tests and docs still required
- "Minor change" - Still needs complete test coverage and spec verification
- Saw property-by-property assertions but didn't flag them
- POST/PUT/PATCH tests exist but didn't check for request body assertions
- Only checked one type in isinstance() for wrapped responses
- Tests don't strictly follow @TESTING.md but "close enough"
- "Type definitions are optional" - Required for new endpoints
- "Python 3.9 syntax is fine" - Must be 3.7 compatible
- Didn't verify ADVANCED.md docs requirements
All of these mean: Review incomplete. Verify spec and mappings first, compare to gold standard, then work through checklist systematically.
Common Review Mistakes
| Mistake | Reality | Fix |
|---|
| Didn't check OpenAPI spec | Cannot verify correctness without it | Get spec, verify every detail |
| Didn't check for breaking changes | Breaking changes break user code | Compare old/new signatures explicitly |
| "No breaking changes mentioned" | You must verify, not trust | Check every signature change against breaking change list |
| "Change seems reasonable" | Reasonable ≠ non-breaking | Verify against explicit breaking change criteria |
| "Spec roughly matches" | Must match EXACTLY | Compare every parameter/field |
| "Tests pass, looks good" | Passing ≠ complete coverage | Check all 5 types exist |
| "Has error tests" | Only checking 1 of 2 error types | Both 4xx AND 5xx required |
| "Response assertions look fine" | Property-by-property missed | Must use .to_dict() == {...} |
| "POST test complete" | Missing request body assertion | Check TESTING.md line 136-141 |
| "Type checking present" | Only wrapper or only inner | Must check BOTH types |
| Missing query assertion pattern | Allows unexpected params | Must assert complete query object |
| "Docs aren't critical" | Sphinx won't discover method | Documentation required, not optional |
| Approving under time pressure | Quality > speed | Request changes, cite standards |
| "Tests look good enough" | Must strictly follow TESTING.md | Reference @TESTING.md standards |
| Didn't verify WireMock mappings | Tests may reference non-existent mappings | Check repo or local path |
| "Mappings probably exist" | Cannot assume - must verify | Verify actual mapping files exist |
| "Type hints are optional" | Type definitions MANDATORY for new endpoints | Request type defs |
| Didn't check Python version | Must support 3.7, no 3.8+ | Verify compatibility |
| Assumed docs needed | Check ADVANCED.md requirements | Verify docs actually needed |
Example Review Comments
For missing OpenAPI spec:
Cannot proceed with review. OpenAPI spec required for verification.
Please provide:
- Smartsheet public API spec: https://developers.smartsheet.com/_spec/api/smartsheet/openapi.json
- OR path to custom OpenAPI spec for this endpoint
Will verify implementation matches spec exactly before approving.
For breaking changes without documentation:
CRITICAL: This PR introduces breaking changes without explicit documentation.
Breaking changes found:
1. Removed optional parameter `include` - breaks calls using this parameter
2. Changed return type from `Union[Sheet, Error]` to `Sheet` - breaks error handling code
3. Changed parameter `format` from optional to required - breaks calls without this parameter
**Impact:** These changes will break existing user code in production.
**Required actions:**
- Either: Revert to backward-compatible design (keep optional params, maintain Union return type)
- Or: Update PR description with "BREAKING CHANGE:" header and provide:
- Justification for breaking changes
- Migration path for existing users
- Version bump strategy (major version)
Cannot approve until breaking changes are either removed or explicitly documented with justification.
For spec mismatch:
Request changes: Implementation doesn't match OpenAPI spec.
Issues found:
- Parameter `pageSize` type: spec says integer, implementation uses string
- Missing required parameter `objectType` from spec
- Response field `directId` not in spec schema
- Query parameter `includeAll` in implementation but not in spec
Please update implementation to match spec exactly at:
[spec path/section]
For missing test types:
Not ready to merge. Missing 3 of 5 required test types:
- test_{method}_required_response_properties (if applicable)
- test_{method}_error_4xx
- test_{method}_error_5xx
See TESTING.md "Mock API Test Standards" for complete requirements.
For property-by-property assertions:
Test assertion pattern needs fixing:
Current (line X):
assert response.id == 123
assert response.name == "test"
Required pattern (TESTING.md):
assert response.to_dict() == {
"id": 123,
"name": "test"
}
Whole-object assertions prevent unexpected properties from creeping in.
For missing request body assertions (POST/PUT/PATCH):
POST/PUT/PATCH endpoints require request body assertions (TESTING.md lines 136-141).
Add to test_{method}_all_response_properties:
wiremock_request = get_wiremock_request(request_id)
request_body = json.loads(wiremock_request["body"])
assert request_body == {
# expected request structure
}
This verifies serialization correctness (camelCase conversion, etc).
For missing type definitions:
Request changes: Missing type definitions for new endpoint.
New endpoints require type definitions in smartsheet/models/.
Required types:
- Request model (if POST/PUT/PATCH with body)
- Response model matching OpenAPI spec schema
All types must be Python 3.7 compatible (no 3.8+ syntax).
See existing models in smartsheet/models/ for patterns.
For Python 3.8+ compatibility issues:
Request changes: Code uses Python 3.8+ features.
This SDK must support Python 3.7. Found:
- Line X: Walrus operator := (requires 3.8)
- Line Y: positional-only parameter / (requires 3.8)
- Line Z: TypedDict without typing_extensions (requires 3.8)
Please update to Python 3.7 compatible syntax.
For tests not matching gold standard:
Tests don't match gold standard patterns. Please review tests/mock_api/reports/ and update:
Current issues:
- Property-by-property assertions (should be `.to_dict() ==`)
- Missing complete query parameter assertion
- Error tests don't follow reports pattern
- Missing request body assertions for POST
Compare your test structure against:
- tests/mock_api/reports/test_create_report.py (POST example)
- tests/mock_api/reports/test_add_report_columns.py (POST example)
Tests should match these patterns exactly.
The Bottom Line
Review is about spec compliance, gold standard pattern matching, and completeness verification.
Implementation can work perfectly but:
- Not match OpenAPI spec (wrong types, missing parameters, extra fields)
- Not match gold standard patterns in tests/mock_api/reports/
- Be incomplete (no tests, no docs)
- Have tests that pass but use wrong assertion patterns
- Have tests that don't follow @TESTING.md standards
- Have documentation that exists but doesn't build
Review workflow:
- Verify OpenAPI spec first - cannot proceed without this
- Verify WireMock mappings - cannot proceed without these
- Open tests/mock_api/reports/ for side-by-side comparison
- Check implementation matches spec exactly
- Verify tests match gold standard patterns exactly
- Verify all 5 test types exist and follow @TESTING.md strictly
- Check assertion patterns (whole-object, not property-by-property)
- Verify documentation updates
Approve only when spec verified AND mappings verified AND patterns match gold standard AND all 4 components are complete and correct.
- Verify OpenAPI spec first - cannot proceed without this
- Check implementation matches spec exactly
- Verify all 5 test types exist and follow @TESTING.md strictly
- Check assertion patterns (whole-object, not property-by-property)
- Verify documentation updates
Approve only when spec verified AND all 4 components are complete and correct.