Skip to content

Commit 1d12e0b

Browse files
authored
Minor fix to RuleContext.getParameter (#131)
* Minor fix to RuleContext.getParameter * Minor cleanup * Minor cleanup
1 parent 1547640 commit 1d12e0b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

schemaregistry/serde/avro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ async function transformField(
314314
fullName,
315315
field.name,
316316
getType(field.type),
317-
ctx.getInlineTags(fullName),
317+
null
318318
)
319319
const newVal = await transform(ctx, field.type, record[field.name], fieldTransform)
320320
if (ctx.rule.kind === 'CONDITION') {

schemaregistry/serde/serde.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export abstract class Deserializer extends Serde {
424424
previous = version
425425
}
426426
if (migrationMode === RuleMode.DOWNGRADE) {
427-
migrations = migrations.map(x => x).reverse()
427+
migrations = migrations.reverse()
428428
}
429429
return migrations
430430
}
@@ -512,16 +512,15 @@ export class RuleContext {
512512

513513
getParameter(name: string): string | null {
514514
const params = this.rule.params
515-
if (params == null) {
516-
return null
517-
}
518-
let value = params[name]
519-
if (value != null) {
520-
return value
515+
if (params != null) {
516+
let value = params[name]
517+
if (value != null) {
518+
return value
519+
}
521520
}
522521
let metadata = this.target.metadata
523522
if (metadata != null && metadata.properties != null) {
524-
value = metadata.properties[name]
523+
let value = metadata.properties[name]
525524
if (value != null) {
526525
return value
527526
}
@@ -545,8 +544,9 @@ export class RuleContext {
545544
return this.fieldContexts[size - 1]
546545
}
547546

548-
enterField(containingMessage: any, fullName: string, name: string, fieldType: FieldType, tags: Set<string>): FieldContext {
549-
let allTags = new Set<string>(tags)
547+
enterField(containingMessage: any, fullName: string, name: string, fieldType: FieldType,
548+
tags: Set<string> | null): FieldContext {
549+
let allTags = new Set<string>(tags ?? this.getInlineTags(fullName))
550550
for (let v of this.getTags(fullName)) {
551551
allTags.add(v)
552552
}

0 commit comments

Comments
 (0)