Repository navigation
fix: declare listOffsets isolationLevel as a number in the options schema - #433
Merged
ShogunPanda merged 1 commit intoOct 1, 2026
Conversation
…hema The listOffsets option schema declared isolationLevel as a string with the FetchIsolationLevels enum, but those values are the numbers 0 and 1. With `strict: true` no value could pass validation: `1` failed the type check and `'1'` failed the enum, so strict consumers could not call listOffsets or listOffsetsWithTimestamps with an isolation level at all. Use the number type, as the consumer's own fetch options and the admin schema already do. Signed-off-by: Fadi Romdhan <fadiromdhan3@gmail.com>
ShogunPanda
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/clients/consumer/options.tsdeclares thelistOffsetsoptionisolationLevelasbut
allowedFetchIsolationLevelsisObject.values(FetchIsolationLevels), i.e. the numbers0and1. Withstrict: true(Ajv runs withcoerceTypes: false) no value can satisfy the schema:FetchIsolationLevels.READ_COMMITTED(1) fails the type check with/options/isolationLevel must be string, and'1'fails the enum.listOffsetsWithTimestampsgoes through the same schema.The consumer's own fetch options (
isolationLevel: { type: 'number', enum: allowedFetchIsolationLevels }) and the admin schema already use the number type; this PR aligns thelistOffsetsschema with them.Test
listOffsets should accept a custom isolation level in strict modeintest/clients/consumer/consumer.test.ts, a strict-mode twin of the existing non-strict test. Onmainit fails with/options/isolationLevel must be string.; with this change it passes against a Kafka 3.9.1 broker.pnpm lintis clean.