From a47dd570420dc67c78edd0722c5d2449a8fad775 Mon Sep 17 00:00:00 2001 From: Johan Brinch Date: Mon, 12 Jul 2021 10:21:03 +0200 Subject: [PATCH] Remove duplicate method and use existing instead --- src/SchemaRegistry.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/SchemaRegistry.ts b/src/SchemaRegistry.ts index 8e55855..c518611 100644 --- a/src/SchemaRegistry.ts +++ b/src/SchemaRegistry.ts @@ -139,7 +139,7 @@ export default class SchemaRegistry { const references = await this.registerReferences(opts, helper, confluentSchema) const referenceSchemas = await Promise.all( references.map(async reference => { - return this.getSchemaForSubject(reference.subject, reference.version) + return this.getSchema(await this.getRegistryId(reference.subject, reference.version)) }), ) @@ -194,15 +194,6 @@ export default class SchemaRegistry { return registeredSchema } - public async getSchemaForSubject(subject: string, version: number): Promise { - const response = await this.api.Subject.version({ - subject, - version, - }) - const schema: { id: number } = response.data() - return await this.getSchema(schema.id) - } - public async getSchema(registryId: number): Promise { const schema = this.cache.getSchema(registryId) @@ -225,7 +216,7 @@ export default class SchemaRegistry { const referenceSchemas = await Promise.all( (foundSchema.references || []).map(async reference => { - return this.getSchemaForSubject(reference.subject, reference.version) + return this.getSchema(await this.getRegistryId(reference.subject, reference.version)) }), )