-
Notifications
You must be signed in to change notification settings - Fork 125
Do not use the blockName from the request in the GET and PATCH endpoints of connection controller #791
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't change the models yet. I'm preparing another PR
There was a problem hiding this 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 removes the use of blockName in the GET and PATCH endpoints of the connection controller and updates associated models and tests to utilize authProviderKey and authProperty instead. Key changes include:
- Removal of the blockNames field from the read request DTO.
- Updates to the AppConnection model to enforce authProviderKey as a required string.
- Adjustments in endpoints, service methods, and tests to reference authProperty instead of block.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/shared/src/lib/app-connection/dto/read-app-connection-request.ts | Removed blockNames property in favor of using authProviderKey. |
packages/shared/src/lib/app-connection/app-connection.ts | Updated authProviderKey type from an optional union to a required string. |
packages/server/api/test/unit/app-connection/connection-providers-resolver.test.ts | Added tests for the new getAuthProviderMetadata helper. |
packages/server/api/test/unit/app-connection/app-connection-service.test.ts | Updated tests to pass authProperty instead of block. |
packages/server/api/src/app/app-connection/connection-providers-resolver.ts | Introduced getAuthProviderMetadata to fetch authentication metadata based on authProviderKey. |
packages/server/api/src/app/app-connection/app-connection.controller.ts | Modified endpoints to use authProperty instead of blockName for data retrieval and redaction. |
packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts | Updated patch method signature and usage from block to authProperty. |
Comments suppressed due to low confidence (2)
packages/shared/src/lib/app-connection/app-connection.ts:113
- Changing authProviderKey from an optional union (string | null) to a required string may lead to compatibility issues with consumers expecting null values. Consider verifying that all model usages are updated or that this change is acceptable.
authProviderKey: Type.String(),
packages/server/api/src/app/app-connection/app-connection.controller.ts:44
- The PATCH endpoint does not currently check whether authProperty is defined before using it in subsequent operations. Adding a validation check and returning an appropriate error status if authProperty is undefined would help prevent unintended behavior.
const authProperty = await getAuthProviderMetadata(request.body.authProviderKey, request.principal.projectId);
Part of OPS-1959.
Additional notes: