-
Notifications
You must be signed in to change notification settings - Fork 941
Update guard API docs to include file upload and multipart support #1063
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
Update guard API docs to include file upload and multipart support #1063
Conversation
- Added multipart/form-data content type to guard API endpoint - Added file parameter for optional PDF file uploads - Updated description to mention PDF file analysis support - Added file validation error example to 400 response This aligns the documentation with the recent SDK changes that added PDF support to the guard functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Pull Request Review: Update guard API docs to include file upload and multipart supportSummaryThis PR updates the OpenAPI documentation for the /api/guard endpoint to reflect the recently added PDF file upload functionality. The changes align the API documentation with the SDK implementation that already supports file uploads. Code Quality and Best PracticesStrengths:
Suggestions:
Potential Issues
Performance Considerations
Security Concerns
Test CoverageCurrent state:
Recommendations: Add tests for PDF file upload, non-PDF file rejection, and handling both text and file parameters Documentation Suggestions
Positive Highlights
Action ItemsRequired before merge:
Recommended for follow-up:
Final Verdict: Approve with Minor SuggestionsThe PR successfully documents the file upload functionality and maintains consistency with the implementation. The changes are minimal, focused, and do not introduce breaking changes. Address the text field requirement clarification, and consider the test coverage suggestions in a follow-up PR. Great work aligning the documentation with the SDK implementation! |
PR Review: Update guard API docs to include file upload and multipart supportSummaryThis PR updates the OpenAPI documentation to reflect the recent addition of PDF file upload support to the /api/guard endpoint. The changes align the documentation with the SDK implementations that already support this feature. Code Quality and Best PracticesStrengths:
Observations:
Potential Issues1. Duplicate Description in guard.mdx (line 20-21)The description is duplicated - it appears both in the frontmatter and as a standalone line before the APIPage component. Recommendation: Remove the duplicate description on line 20. 2. Similar Duplication in redact.mdx (line 19-20)Same issue - the description appears to be duplicated. 3. Schema Requirement InconsistencyIn the multipart/form-data schema (docs/openapi.json:265-266), text is marked as required, but the description says can be empty string when file is provided. This creates an ambiguous API contract. Recommendation: Change to empty required array and document that at least one of text or file must be provided. 4. Missing File Size/Type Validation DocumentationThe error example shows file must be PDF, but the schema does not specify:
Performance ConsiderationsFile Upload Implications:
Content-Type Handling: The multipart implementation looks correct - both SDKs properly let the browser/fetch set the boundary parameter. Security ConcernsFile Upload SecurityGood defensive practices observed:
Minor Concerns:
Recommendation: Ensure the backend validates PDF structure, enforces reasonable file size limits (less than 10MB recommended), and sanitizes file content. API Key ExposureBoth SDKs correctly handle API keys through headers, not query params - good practice. Test CoverageCurrent StateStrengths:
Gap Identified: No tests for PDF file uploads to the guard endpoint Both test suites test text input, callbacks, and error handling, but NOT file upload functionality or multipart form-data submission. Recommendation: Add test cases for file upload scenarios in both SDKs. Summary and Action ItemsMust Fix:
Should Add:
Nice to Have:
Overall AssessmentRating: Approve with Minor Changes This is a solid documentation update that aligns the API spec with existing SDK implementations. The core changes are correct and follow good practices. The issues identified are minor and mostly around documentation completeness, test coverage gaps, and minor formatting issues. The security model is sound, and the implementation in the SDKs is already production-ready. Once the documentation duplicates are removed and test coverage is added, this will be in excellent shape. Great work on maintaining consistency between the SDK implementations and API documentation! Files Reviewed:
|
Description
This aligns the documentation with the recent SDK changes that added PDF support to the guard functionality.
Checklist