@@ -257,16 +257,15 @@ export abstract class Serializer extends Serde {
257257 id = await this . client . register ( subject , info , Boolean ( normalizeSchema ) )
258258 } else if ( useSchemaId != null && useSchemaId >= 0 ) {
259259 info = await this . client . getBySubjectAndId ( subject , useSchemaId , format )
260- id = await this . client . getId ( subject , info , false )
261- if ( id !== useSchemaId ) {
262- throw new SerializationError ( `failed to match schema ID (${ id } != ${ useSchemaId } )` )
263- }
260+ id = useSchemaId
264261 } else if ( useLatestWithMetadata != null && Object . keys ( useLatestWithMetadata ) . length !== 0 ) {
265- info = await this . client . getLatestWithMetadata ( subject , useLatestWithMetadata , true , format )
266- id = await this . client . getId ( subject , info , false )
262+ let metadata = await this . client . getLatestWithMetadata ( subject , useLatestWithMetadata , true , format )
263+ info = metadata
264+ id = metadata . id
267265 } else if ( useLatest ) {
268- info = await this . client . getLatestSchemaMetadata ( subject , format )
269- id = await this . client . getId ( subject , info , false )
266+ let metadata = await this . client . getLatestSchemaMetadata ( subject , format )
267+ info = metadata
268+ id = metadata . id
270269 } else {
271270 id = await this . client . getId ( subject , info , Boolean ( normalizeSchema ) )
272271 }
0 commit comments