Skip to content

Standardize API error responses and Swagger documentation across all endpoints#627

Merged
jfrench9 merged 5 commits intomainfrom
refactor/api-swagger-doc-alignment
Apr 16, 2026
Merged

Standardize API error responses and Swagger documentation across all endpoints#627
jfrench9 merged 5 commits intomainfrom
refactor/api-swagger-doc-alignment

Conversation

@jfrench9
Copy link
Copy Markdown
Member

Summary

Large-scale refactor to align API error response handling and OpenAPI/Swagger documentation across the entire router layer. This PR introduces standardized error response models, applies them consistently to ~50+ endpoint files, and includes minor supporting changes for SDK tooling and Dagster asset additions.

Key Accomplishments

Standardized Error Response Documentation

  • Introduced common error response models in robosystems/models/api/common.py to provide reusable, consistent error schemas (e.g., 400, 401, 403, 404, 409, 422, 500) for OpenAPI documentation.
  • Updated all router modules across auth, billing, extensions, graphs, orgs, user, and top-level routers to use the new standardized responses declarations in their endpoint decorators.
  • Significantly reduced boilerplate and inline response definitions, replacing them with references to shared models. This results in a cleaner, more accurate Swagger/OpenAPI spec.

Router Modules Updated

  • Auth: captcha, email verification, login, logout, password, password reset, register, session, SSO
  • Billing: checkout, customer, invoices, subscriptions
  • Extensions: roboinvestor operations, roboledger operations & views
  • Graphs: agent execution, backups, connections (management, OAuth, options, sync), credits, documents, files (main & upload), health, info, limits, main (graph CRUD), MCP (execute & tools), operations, query execution, schema (export, info, validate), search, subgraphs (info, main, quota), subscriptions, tables (main & query), usage
  • Orgs: main, members, usage
  • User: API keys, main, password
  • Top-level: offering, operations, status

Dagster Pipeline Addition

  • Added user_graph_extensions_materialized_source asset for extensions materialization in the Dagster data pipeline.
  • Registered new asset and updated job definitions accordingly.

SDK & Tooling

  • Bumped robosystems-client dependency from previous version to 0.3.8.
  • Added SDK update task to .vscode/tasks.json and justfile for streamlined developer workflow.

Breaking Changes

  • OpenAPI schema changes: The Swagger/OpenAPI spec will now include standardized error response schemas for all endpoints. Clients generated from the OpenAPI spec may see updated error response types. The actual runtime behavior and status codes should remain unchanged.
  • No breaking changes to request/response payloads for success cases.

Testing Notes

  • Verify the generated OpenAPI spec (/docs or /openapi.json) reflects correct and consistent error response schemas across all endpoints.
  • Confirm that error responses at runtime match the documented models (status codes, body structure).
  • Validate that the new Dagster asset user_graph_extensions_materialized_source materializes correctly in the pipeline.
  • Ensure the updated robosystems-client v0.3.8 is compatible and SDK generation tooling works as expected.

Infrastructure Considerations

  • The Dagster definitions have been updated with new assets and job configurations; ensure the orchestration environment picks up the new materialization source.
  • The dependency lock file (uv.lock) has been updated — CI/CD pipelines should install fresh dependencies.
  • OpenAPI spec consumers (SDK generators, documentation portals, API gateways) should be refreshed after this merge to reflect the updated documentation.

🤖 Generated with Claude Code

Branch Info:

  • Source: refactor/api-swagger-doc-alignment
  • Target: main
  • Type: refactor

Co-Authored-By: Claude noreply@anthropic.com

…ization

- Introduced a new asset specification for materializing extensions data from PostgreSQL to LadybugDB.
- Updated relevant imports and asset lists to include the new user_graph_extensions_materialized_source.
- Enhanced the materialization logging to capture detailed metadata about the process, including tables materialized and duration.
…points

- Introduced shared error response dictionaries for consistent Swagger documentation, including COMMON_ERROR_RESPONSES, AUTHENTICATED_ERROR_RESPONSES, RESOURCE_ERROR_RESPONSES, and OPERATION_ERROR_RESPONSES.
- Updated various API endpoints to utilize these shared error responses, improving maintainability and clarity in error handling.
- Refined endpoint descriptions for better understanding and streamlined responses for common error scenarios.
- Upgraded the robosystems-client dependency from version 0.3.7 to 0.3.8 in pyproject.toml and uv.lock.
- Introduced a new `sdk-update` task in the justfile for upgrading the SDK and re-installing dependencies.
- Added a corresponding task in the VSCode tasks configuration for easier SDK updates.
- Changed the asset key from "extensions_materialize" to "user_graph_extensions_materialized" in the ExtensionsMaterializeTask class to improve clarity and consistency in reporting.
- Simplified the logic in the StrategySelector class to always return JSON_COMPLETE for clients without streaming support, regardless of result size.
- Removed outdated comments and unnecessary conditions related to NDJSON handling for large results, improving code clarity and maintainability.
@jfrench9 jfrench9 merged commit 50abe32 into main Apr 16, 2026
7 checks passed
@jfrench9 jfrench9 deleted the refactor/api-swagger-doc-alignment branch April 16, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant