Repository navigation
Revert union of Pools PR - #459
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reverts a previous "union of Pools" feature that allowed the identityPoolId field in BearerAuthCredentials to accept either a single string or an array of strings. The revert restores the original behavior where identityPoolId is a single string value.
Changes:
- Reverts
identityPoolIdtype fromstring | string[]back tostringinBearerAuthCredentialsinterface - Changes validation logic to require both
logicalClusterandidentityPoolIdfields - Removes all test cases for union-of-pools functionality including array handling and optional identityPoolId tests
- Updates example documentation comment to reflect single pool ID usage
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| schemaregistry/rest-service.ts | Reverts BearerAuthCredentials.identityPoolId type to string and updates validation logic to require it |
| schemaregistry/test/rest-service.spec.ts | Removes BearerAuthCredentials import and all bearer auth test cases added for union-of-pools feature |
| schemaregistry-examples/src/constants.ts | Updates comment to remove mention of comma-separated union-of-pools usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import axios from 'axios'; | ||
| import MockAdapter from 'axios-mock-adapter'; | ||
| import { RestService, BearerAuthCredentials } from '../rest-service'; | ||
| import { RestService } from '../rest-service'; |
There was a problem hiding this comment.
The removed import of BearerAuthCredentials is correct since it's no longer used in the test file after removing the bearer auth tests. However, consider verifying that the removed tests are not needed for the current functionality. If identityPoolId is still meant to be optional (as the interface suggests), these tests should be updated rather than removed.
| scope?: string, | ||
| logicalCluster?: string, | ||
| identityPoolId?: string | string[], | ||
| identityPoolId?: string, |
There was a problem hiding this comment.
The revert correctly changes the type from string | string[] back to string, but fails to update whether identityPoolId should be required or optional. This inconsistency is also present in the implementation at lines 122-127 where identityPoolId is required at runtime despite being marked as optional here.
| identityPoolId?: string, | |
| identityPoolId: string, |
| const headers = ['logicalCluster', 'identityPoolId']; | ||
| const missingHeader = headers.find(header => !(header in bearerAuthCredentials)); | ||
|
|
||
| if (poolId) { | ||
| headers['Confluent-Identity-Pool-Id'] = poolId; | ||
| if (missingHeader) { | ||
| throw new Error(`Bearer auth header '${missingHeader}' not provided`); | ||
| } |
There was a problem hiding this comment.
Incomplete revert: The identityPoolId field is still marked as optional in the BearerAuthCredentials interface (line 36 has identityPoolId?: string), but the implementation now requires it to be present (lines 122-127). This creates a discrepancy between the TypeScript type definition and runtime behavior.
If identityPoolId should be required after the revert, update line 36 to remove the optional marker: identityPoolId: string. If it should remain optional, the validation logic needs to be updated to only check for logicalCluster and conditionally set the header only when identityPoolId is provided.
Please prefix all TypeScript pull-requests with
[Typescript]What
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups