Skip to content

Conversation

@maxxgx
Copy link
Contributor

@maxxgx maxxgx commented Nov 7, 2025

πŸ“ Description

improve openapi spec for creating sources and sinks

✨ Changes

Select what type of change your PR is:

  • πŸš€ New feature (non-breaking change which adds functionality)
  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • πŸ”„ Refactor (non-breaking change which refactors the code base)
  • ⚑ Performance improvements
  • 🎨 Style changes (code style/formatting)
  • πŸ§ͺ Tests (adding/modifying tests)
  • πŸ“š Documentation update
  • πŸ“¦ Build system changes
  • 🚧 CI/CD configuration
  • πŸ”§ Chore (general maintenance)
  • πŸ”’ Security update
  • πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)

βœ… Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • πŸ“š I have made the necessary updates to the documentation (if applicable).
  • πŸ§ͺ I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).
  • 🏷️ My PR title follows conventional commit format.

For more information about code review checklists, see the Code Review Checklist.

Signed-off-by: Ma, Xiangxiang <[email protected]>
Copilot AI review requested due to automatic review settings November 7, 2025 16:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the OpenAPI specification for creating sources and sinks by introducing dedicated creation schema models that handle ID fields appropriately for POST requests. The changes eliminate the need to accept raw dictionaries in the API endpoints, providing better type safety and automatic OpenAPI documentation generation.

Key Changes:

  • Introduced SourceCreate and SinkCreate schema types with optional/auto-generated IDs
  • Refactored endpoint handlers to use strongly-typed models instead of dictionaries
  • Removed test cases for DISCONNECTED type validation (since these types are now excluded from the creation schemas)

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
application/backend/src/pydantic_models/base.py Added NoRequiredIDs mixin class to make ID fields optional and excluded from JSON schema for creation requests
application/backend/src/pydantic_models/source.py Created source-specific creation schema classes that exclude required IDs
application/backend/src/pydantic_models/sink.py Created sink-specific creation schema classes that exclude required IDs
application/backend/src/api/endpoints/source_endpoints.py Updated create endpoint to use SourceCreate type instead of dict and corresponding adapter
application/backend/src/api/endpoints/sink_endpoints.py Updated create endpoint to use SinkCreate type instead of dict and corresponding adapter
application/backend/src/main.py Fixed string conversion bug in validation error handler
application/backend/tests/unit/endpoints/test_sources_sinks.py Removed test case for DISCONNECTED type creation validation

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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