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

fix: 🐛 handle protobuf schemas referenced by -1 version #262

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/SchemaRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,13 @@ export default class SchemaRegistry {
helper: SchemaHelper,
referencesSet: Set<string>,
): Promise<ConfluentSchema[]> {
const { name, subject, version } = reference
const { name, subject } = reference

const versionResponse = await this.api.Subject.version(reference)
const foundSchema = versionResponse.data() as SchemaResponse

// rely on version retrieved from the registry, because references may use -1 as version
const { version } = foundSchema
const key = `${name}-${subject}-${version}`

// avoid duplicates
Expand All @@ -222,9 +228,6 @@ export default class SchemaRegistry {
}
referencesSet.add(key)

const versionResponse = await this.api.Subject.version(reference)
const foundSchema = versionResponse.data() as SchemaResponse

const schema = helper.toConfluentSchema(foundSchema)
const referencedSchemas = await this.getreferencedSchemasRecursive(
schema,
Expand Down
Loading