-
Notifications
You must be signed in to change notification settings - Fork 6
Document API endpoint parameters and endpoints with descriptions and examples for Swagger UI #1228
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: eecavanna <[email protected]>
|
I want @copilot to also document the endpoints, themselves (e.g. by adding a docstring to each endpoint function or a description kwarg to each router decoration). |
… function docstrings Co-authored-by: eecavanna <[email protected]>
I've added comprehensive endpoint documentation as requested. The changes include: Router descriptions: Added Function docstrings: Added detailed docstrings to all endpoint functions explaining their functionality, parameters, and return values. This enhancement covers 38 endpoints across 11 files with both router-level descriptions and function-level documentation. The documentation explains the purpose of each operation, what data it returns, and any important behavioral notes. Commit: dcd61ec |
|
Hi @dwinston, no need to review this independently (although you can if you want); I just wanted to tell you I'm planning to pull this PR up (on screen) next time we pair, and using it as a sort of guide for a conversation. There are multiple endpoints (among these) that I'm not familiar with and I think I'd benefit from hearing you summarize them. Ultimately, I do want to document them, but documenting them in real time might make the conversation take longer than we have. |
|
I forgot to mention: all commits on this branch were made by GitHub Copilot (i.e., AI). I haven't reviewed most of the changes, myself, yet (I started to while out for a walk, but only got through 2-3 files). |
This PR enhances the NMDC Runtime API documentation by adding detailed parameter descriptions and examples to endpoint path parameters, as well as comprehensive endpoint documentation, making the Swagger UI much more user-friendly for developers.
Problem
Previously, API endpoint parameters in Swagger UI showed only generic descriptions like "doc_id" with no context about what values were expected or what format to use. Additionally, endpoints themselves lacked clear descriptions of their purpose and functionality. This made it difficult for developers to understand how to properly use the API endpoints.
Before:
After:
Solution
Parameter Documentation
Updated 28 parameters across 9 endpoint files using FastAPI's
Annotatedtype withPathandQueryparameters that include:Endpoint Documentation
Enhanced 38 endpoints across 11 endpoint files with:
descriptionparameter to@router.get(),@router.post(), etc. decoratorsUpdated Endpoints
Sites Management:
/sites/{site_id}- Site operations and credential generation/sites/{site_id}:putObject- Object storage operations/sites/{site_id}:getObjectLink- Object link generationWorkflow Operations:
/workflows/{workflow_id}- Workflow retrieval and capabilities/workflows/{workflow_id}/object_types- Workflow object type listing/workflows/{workflow_id}/capabilities- Workflow capability listingData Management:
/objects/{object_id}/*- Object operations and access management/object_types/{object_type_id}/*- Object type operations/capabilities/{capability_id}- Capability operationsJob Execution:
/jobs/{job_id}/*- Job claiming, releasing, and status operations/operations/{op_id}/*- Operation tracking and updates/runs/{run_id}/*- Run summaries and event listingID Management:
/ids/bindings/{rest:path}- Identifier resolution/triggers/{trigger_id}- Trigger operationsAuthentication:
Example Implementation
Verification
nmdc:sty-11-abc123,nmdc:dobj-11-abc123)This improvement significantly enhances the developer experience by providing contextual, actionable information directly in the Swagger UI interface and comprehensive documentation for code maintainability.
Fixes #651.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.