Release v0.1.20 — Phase 20: API Documentation#291
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pecification-skeleton CONV-313: Create OpenAPI specification skeleton
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dation-test CONV-314: Add OpenAPI validation test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hentication CONV-315: Document API authentication
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d-api-errors CONV-316: Document standard API errors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ers-index-endpoint CONV-317: Document converters index endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er-schema-endpoint CONV-318: Document converter schema endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…load-endpoint CONV-319: document file upload endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rget-formats-endpoint CONV-320: document file target formats endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion-cost-estimate-endpoint CONV-321: document conversion cost estimate endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…conversion-endpoint CONV-322: document create conversion endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion-status-endpoint CONV-323: document conversion status endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion-download-endpoint CONV-324: document conversion download endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-balance-endpoint CONV-325: document credits balance endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation-page CONV-326: Add API documentation page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ickstart-section CONV-327: Add developer quickstart section
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-and-curl-snippets CONV-328: Add API examples and curl snippets
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation-final-smoke-tests CONV-329: Add API documentation final smoke tests
📝 WalkthroughWalkthroughThis PR adds comprehensive API documentation for the File Converter API by defining a complete OpenAPI 3.1.0 specification, creating a Redoc-powered documentation page, and adding feature tests to validate both the documentation rendering and the OpenAPI contract structure. ChangesAPI Documentation and Specification
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
tests/Pest.php (1)
55-58: 💤 Low valueConsider documenting potential exceptions in a docblock.
The
Yaml::parseFile()call can throw exceptions if the file is missing or the YAML is malformed. While letting exceptions bubble up is acceptable for test helpers (failures signal real problems), a docblock would clarify the function's behavior for future maintainers.📝 Optional docblock addition
+/** + * Parse the OpenAPI specification file. + * + * `@return` array The parsed OpenAPI spec + * `@throws` \Symfony\Component\Yaml\Exception\ParseException If YAML is malformed + */ function openApiSpec(): array { return Yaml::parseFile(base_path('docs/api/openapi.yaml')); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/Pest.php` around lines 55 - 58, Document that openApiSpec() calls Yaml::parseFile which can throw on missing files or malformed YAML; add a docblock above the openApiSpec function mentioning the possible exceptions (e.g. `@throws` \Symfony\Component\Yaml\Exception\ParseException and/or `@throws` \RuntimeException or `@throws` \Throwable) and state that exceptions are intentionally left to bubble up for tests to fail loudly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/api/openapi.yaml`:
- Around line 6-10: The servers list in the OpenAPI spec currently hardcodes
environment-specific URLs; update the servers entry so the default server URL is
deployment-agnostic (use a relative path such as /api/v1) instead of
https://example.com/api/v1 or http://localhost/api/v1 so generated clients and
docs point at the hosting app; edit the servers array in docs/api/openapi.yaml
(the servers block shown) to replace the absolute URLs with a single relative
URL like /api/v1 and keep or adjust the descriptions accordingly.
- Around line 396-398: OpenAPI 3.1 removes the `nullable` keyword; update
OptionField.default and Conversion.result_file to use JSON Schema nullability:
for OptionField.default (symbol: OptionField.default) change the schema from
`nullable: true` to a type that allows null (e.g., type: [ "string", "null" ] or
anyOf with type 'null'), keeping the example; for Conversion.result_file
(symbol: Conversion.result_file) replace `nullable: true` + $ref with an anyOf
that allows either the File schema or null (e.g., anyOf: - $ref:
'`#/components/schemas/File`' - { type: 'null' }). Ensure no `nullable` keywords
remain in the file.
In `@resources/views/docs/api.blade.php`:
- Around line 49-83: The examples in the docs currently hardcode
"https://example.com/api/v1/..." in the curl command blocks, making them
non-portable; replace those literal URLs with the app's runtime base (e.g. use
Blade's url() helper or an injected $apiBase) across every curl snippet (each
occurrence of "https://example.com/api/v1/files",
"https://example.com/api/v1/conversions/estimate",
"https://example.com/api/v1/conversions",
"https://example.com/api/v1/conversions/{id}", and the download URL) so the
snippets render as "{{ url('/api/v1/...') }}" or "$apiBase/api/v1/..." in the
template; ensure the change is applied to all six examples (upload, list
targets, estimate, create conversion, poll status, download) so they remain
copy-pasteable in any environment.
---
Nitpick comments:
In `@tests/Pest.php`:
- Around line 55-58: Document that openApiSpec() calls Yaml::parseFile which can
throw on missing files or malformed YAML; add a docblock above the openApiSpec
function mentioning the possible exceptions (e.g. `@throws`
\Symfony\Component\Yaml\Exception\ParseException and/or `@throws`
\RuntimeException or `@throws` \Throwable) and state that exceptions are
intentionally left to bubble up for tests to fail loudly.
🪄 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: 60e31f02-57b5-4243-8806-55408d02e8ff
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
composer.jsondocs/api/openapi.yamlresources/views/docs/api.blade.phproutes/web.phptests/Feature/Docs/ApiDocumentationPageTest.phptests/Feature/Docs/OpenApiPathsTest.phptests/Feature/Docs/OpenApiSpecificationTest.phptests/Pest.php
There was a problem hiding this comment.
2 issues found across 9 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…ic curl URLs, pin Redoc CDN - Replace absolute server URLs with relative /api/v1 - Fix OptionField.default: nullable:true → type: ['string','null'] (OAS 3.1) - Fix Conversion.result_file: nullable:true + $ref → anyOf (OAS 3.1) - Replace hardcoded https://example.com curl URLs with url() helper - Pin Redoc CDN from /latest/ to /2.x/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix OpenAPI review issues
Summary
docs/api/openapi.yaml) documenting all 9 Phase 19 API endpoints/docs/apipage with Redoc UI, developer quickstart, and curl examplesChanges (CONV-313–329)
symfony/yaml,openApiSpec()helper)ErrorResponse,ErrorObject, reusable responses)GET /convertersGET /converters/{source}/{target}/schemaPOST /filesGET /files/{file}/targetsPOST /conversions/estimatePOST /conversionsGET /conversions/{conversion}GET /conversions/{conversion}/downloadGET /credits/balance/docs/apiroute + Redoc UI viewTest plan
composer test)composer lintpassesnpm run buildpasses/docs/apiis public (no auth required)🤖 Generated with Claude Code
Summary by cubic
Publish public API docs: an OpenAPI 3.1 spec and a Redoc-powered
/docs/apipage covering all Phase 19 endpoints. Includes follow-up fixes for OpenAPI 3.1 compliance and more robust docs, completing CONV-313–329.New Features
docs/api/openapi.yamldocumenting converters, files, conversions, and credits (9 endpoints)./docs/apiwith Redoc UI, developer quickstart, and curl examples; spec served at/docs/api/openapi.yaml.symfony/yaml(dev) to parse the spec.Bug Fixes
/api/v1; fix nullability withanyOf(e.g.,Conversion.result_file); setOptionField.defaultto['string','null'].url(); pin Redoc CDN to2.x.Written for commit 100920d. Summary will update on new commits.
Summary by CodeRabbit
Documentation