Skip to content
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

Backend: include required headers in swagger #935

Merged
merged 11 commits into from
Feb 7, 2025

Conversation

ezawadski
Copy link
Collaborator

@ezawadski ezawadski commented Feb 5, 2025

Adjusted the injectable dependencies to specify the headers expected.

Had to change organization_id as a query parameter because it was conflicting with organization-id header in the generated client. This had no effect on frontend, because organization_id query parameter is not used.

Also took care of TODO for having auth on only some endpoints in the user router.

AI Description

This PR introduces a new DependencyType class to the src/backend/config/routers.py file, which is used to define the dependencies for each router. The RouterName class is also updated to include a new DependencyType attribute.

The src/backend/main.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/routers/agent.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/routers/organization.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/routers/user.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/services/auth/request_validators.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/services/auth/utils.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/services/request_validators.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/integration/routers/test_agent.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/integration/routers/test_conversation.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/unit/routers/auth/test_authorization_header.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/unit/routers/test_chat.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/unit/routers/test_conversation.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/backend/tests/unit/services/auth/test_request_validators.py file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/interfaces/coral_web/src/cohere-client/generated/services.gen.ts file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/interfaces/coral_web/src/cohere-client/generated/types.gen.ts file is updated to import the new DependencyType class and use it to set the router dependencies.

The src/interfaces/assistants_web/src/components/UI/Slider.tsx file is updated to import the new DependencyType class and use it to set the router dependencies.

  • The src/backend/config/routers.py file is updated to include a new DependencyType class, which is used to define the dependencies for each router. The RouterName class is also updated to include a new DependencyType attribute.
  • The src/backend/main.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/routers/agent.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/routers/organization.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/routers/user.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/services/auth/request_validators.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/services/auth/utils.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The src/backend/services/request_validators.py file is updated to import the new DependencyType class and use it to set the router dependencies.
  • The <co: 8>`src/backend/tests/integration

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 92.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 79.76%. Comparing base (2b30f73) to head (6336bf4).

Files with missing lines Patch % Lines
src/backend/routers/agent.py 50.00% 2 Missing ⚠️
src/backend/services/auth/utils.py 33.33% 2 Missing ⚠️
src/backend/main.py 66.66% 1 Missing ⚠️
src/backend/services/request_validators.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #935      +/-   ##
==========================================
- Coverage   79.77%   79.76%   -0.01%     
==========================================
  Files         295      295              
  Lines       11965    11951      -14     
==========================================
- Hits         9545     9533      -12     
+ Misses       2420     2418       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn left a comment

Choose a reason for hiding this comment

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

Looks good to me—just one small question to confirm

src/backend/services/request_validators.py Show resolved Hide resolved
src/backend/services/request_validators.py Show resolved Hide resolved
@ezawadski ezawadski merged commit 90a5e7e into main Feb 7, 2025
8 checks passed
@ezawadski ezawadski deleted the eric/tlk-2942-include-required-headers-in-swagger branch February 7, 2025 17:06
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.

3 participants