feat(api-docs): adopt Scalar for interactive API documentation#790
Open
vcnainala wants to merge 4 commits into
Open
feat(api-docs): adopt Scalar for interactive API documentation#790vcnainala wants to merge 4 commits into
vcnainala wants to merge 4 commits into
Conversation
Lomkit's Responses::withOthers() used array_merge(), which reindexed numeric keys such as 500 to 0 and broke Scalar's OpenAPI parser. Add a custom Responses schema that merges with + instead, sanitize invalid keys when generating docs, and regenerate the published specification.
Serve the Lomkit OpenAPI spec through Scalar on /api-documentation with COCONUT branding, black body text, and a single header logo. Allow fonts.scalar.com in the CSP for Scalar default web fonts.
Replace Swagger-specific wording with generic interactive API documentation guidance for Bearer token authentication.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #790 +/- ##
================================================
- Coverage 6.14% 6.13% -0.02%
- Complexity 1736 1739 +3
================================================
Files 227 228 +1
Lines 8945 8967 +22
================================================
Hits 550 550
- Misses 8395 8417 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api-documentationwith Scalar loaded from jsDelivr, including COCONUT branding (single header logo, black text, green accent).500,401) are preserved instead of being mangled to0or"\"500\"", which caused Scalar to fail parsing the spec and ignore deep links such as#tag/advanced-search/post/api/search.fonts.scalar.comin the Content Security Policy for Scalar’s default fonts.Commits
fix(api-docs): preserve HTTP status codes in OpenAPI response generationfeat(api-docs): replace Swagger UI with Scalar reference UIdocs(api-docs): update authentication instructions for Scalar UITest plan
http://localhost/api-documentationand confirm Scalar loads without console errorshttp://localhost/api-documentation#tag/advanced-search/post/api/searchand confirm the Advanced Molecule Search operation is shown (not Introduction)php artisan coconut:generate-api-docsand confirmpublic/vendor/rest/openapi.jsonkeeps valid response keys (500, not0)connect-srcin the browser console