Add schema to download_all and series_autonumber_range#7815
Conversation
Triggered by 33b7364 on branch refs/heads/issue-7596
📝 WalkthroughWalkthroughAdds OpenAPI schema decorators to two backend endpoints (download_all and series_autonumber_range) and applies formatting/whitespace changes across multiple frontend TypeScript/React files. No runtime behavior, endpoint signatures, or exported/public APIs were changed. ChangesAPI Schema Documentation
Frontend Formatting & Configuration
🚥 Pre-merge checks | ✅ 3 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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: 2
🧹 Nitpick comments (1)
specifyweb/backend/series/views.py (1)
35-52: ⚡ Quick winDocument
400/500responses to match actual endpoint behavior.The view returns
400for invalid ranges and500for unexpected failures, but the schema only advertises200. Adding these responses will make generated API clients and docs more accurate.🤖 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 `@specifyweb/backend/series/views.py` around lines 35 - 52, The OpenAPI responses dict in the view currently only documents a 200 response; update the responses mapping used in the view's "responses" definition to also include "400" and "500" entries that reflect actual behavior: add a "400" response with description like "Invalid range" and a JSON schema with an "error" string (and optionally "details"), and add a "500" response with description like "Internal server error" and a JSON schema containing an "error" string; modify the same responses object used by the view (the "responses" dict in the view function/class) so generated docs and clients show these status codes.
🤖 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 `@specifyweb/backend/attachment_gw/views.py`:
- Line 331: Fix the typo in the API description for the recordsetid field:
locate the dictionary entry where the "description" for "recordsetid" is defined
in attachment_gw/views.py and replace "attachmends" with the correct word
"attachments" so the description reads "Optional. Will download all attachments
in the recordset. Using this will ignore all other properties."
- Around line 329-335: The JSON schema currently requires "attachmentlocations"
and "origfilenames" unconditionally which contradicts the intent that a request
may supply only "recordsetid"; update the schema object that defines
"recordsetid" so it expresses the two allowed shapes (either recordsetid-only OR
attachmentlocations+origfilenames). Replace the flat "required":
["attachmentlocations","origfilenames"] with an anyOf (or oneOf) that has two
subschemas: one requiring ["recordsetid"] and the other requiring
["attachmentlocations","origfilenames"]; keep the existing property definitions
for "recordsetid", "attachmentlocations", and "origfilenames" intact. Ensure the
change is made in the same schema dict in views.py where the "recordsetid"
property and "required" list currently appear.
---
Nitpick comments:
In `@specifyweb/backend/series/views.py`:
- Around line 35-52: The OpenAPI responses dict in the view currently only
documents a 200 response; update the responses mapping used in the view's
"responses" definition to also include "400" and "500" entries that reflect
actual behavior: add a "400" response with description like "Invalid range" and
a JSON schema with an "error" string (and optionally "details"), and add a "500"
response with description like "Internal server error" and a JSON schema
containing an "error" string; modify the same responses object used by the view
(the "responses" dict in the view function/class) so generated docs and clients
show these status codes.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3ec47463-645b-49a0-9ccf-d7c1fe3a0cfc
📒 Files selected for processing (16)
specifyweb/backend/attachment_gw/views.pyspecifyweb/backend/series/views.pyspecifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.tsspecifyweb/frontend/js_src/lib/components/ExpressSearchConfig/ExpressSearchConfigDialog.tsxspecifyweb/frontend/js_src/lib/components/ExpressSearchConfig/ResultsOrderingTab.tsxspecifyweb/frontend/js_src/lib/components/ExpressSearchConfig/__tests__/ExpressSearchConfigEditor.test.tsxspecifyweb/frontend/js_src/lib/components/ExpressSearchConfig/__tests__/RelatedTablesTab.test.tsxspecifyweb/frontend/js_src/lib/components/ExpressSearchConfig/__tests__/ResultsOrderingTab.test.tsxspecifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsxspecifyweb/frontend/js_src/lib/components/Header/ExpressSearchHooks.tsxspecifyweb/frontend/js_src/lib/components/Header/ExpressSearchTask.tsxspecifyweb/frontend/js_src/lib/components/Notifications/NotificationRenderers.tsxspecifyweb/frontend/js_src/lib/components/WbPlanView/navigator.tsspecifyweb/frontend/js_src/lib/localization/common.tsspecifyweb/frontend/js_src/lib/localization/utils/config.tsspecifyweb/frontend/js_src/lib/utils/schemaVisibility.ts
|
@alesan99 could you:
|
|
This PR is complete and ready to be tested. It adds descriptions to the API documentation for download_all and series_autonumber_range, no functionality has been changed. |
emenslin
left a comment
There was a problem hiding this comment.
- Find and make sure the schema for
/specify/attachment_gw/download_alllooks correct. The request body should now be there. - Find and make sure the schema for
/specify/series_autonumber_rangelooks correct. The request body should now be there.
Looks good, the request body is now there for both.
Iwantexpresso
left a comment
There was a problem hiding this comment.
-
Find and make sure the schema for /specify/attachment_gw/download_all looks correct. The request body should now be there.
-
Find and make sure the schema for /specify/series_autonumber_range looks correct. The request body should now be there.
the documentation looks clean, nice work!
Fixes #7596
Adds API schemas to the endpoints I added before.
Checklist
self-explanatory (or properly documented)
Testing instructions
/specify/attachment_gw/download_alllooks correct. The request body should now be there./specify/series_autonumber_rangelooks correct. The request body should now be there.Summary by CodeRabbit
Documentation
Chores