Skip to content

Commit

Permalink
only set compatibility on first time registration
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed Apr 5, 2022
1 parent c3bc207 commit 5230831
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SchemaRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class SchemaRegistry {
const helper = helperTypeFromSchemaType(confluentSchema.type)
const schemaInstance = schemaFromConfluentSchema(confluentSchema, this.options)
helper.validate(schemaInstance)

let isFirstTimeRegistration = false
let subject: ConfluentSubject
if (userOpts?.subject) {
subject = {
Expand All @@ -134,6 +134,8 @@ export default class SchemaRegistry {
} catch (error) {
if (error.status !== 404) {
throw error
} else {
isFirstTimeRegistration = true
}
}

Expand All @@ -145,7 +147,7 @@ export default class SchemaRegistry {
},
})

if (compatibility) {
if (compatibility && isFirstTimeRegistration) {
await this.api.Subject.updateConfig({ subject: subject.name, body: { compatibility } })
}

Expand Down

0 comments on commit 5230831

Please sign in to comment.