File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -176,9 +176,15 @@ export function toStringModel(
176176 name : string
177177) : StringModel | undefined {
178178 if (
179- ( typeof avroSchemaModel . type === 'string' ||
179+ ( ( typeof avroSchemaModel . type === 'string' ||
180+ Array . isArray ( avroSchemaModel . type ) ) &&
181+ avroSchemaModel . type . includes ( 'string' ) ) ||
182+ ( ( typeof avroSchemaModel . type === 'string' ||
183+ Array . isArray ( avroSchemaModel . type ) ) &&
184+ avroSchemaModel . type . includes ( 'fixed' ) ) ||
185+ ( ( typeof avroSchemaModel . type === 'string' ||
180186 Array . isArray ( avroSchemaModel . type ) ) &&
181- avroSchemaModel . type . includes ( 'string' )
187+ avroSchemaModel . type . includes ( 'bytes' ) )
182188 ) {
183189 return new StringModel (
184190 name ,
Original file line number Diff line number Diff line change @@ -178,6 +178,26 @@ describe('AvroToMetaModel', () => {
178178 expect ( model ) . not . toBeUndefined ( ) ;
179179 expect ( model instanceof ArrayModel ) . toBeTruthy ( ) ;
180180 } ) ;
181+ test ( 'should handle AvroSchema value of type fixed' , ( ) => {
182+ const av = new AvroSchema ( ) ;
183+ av . name = 'test' ;
184+ av . type = { name : 'test1' , type : 'fixed' } ;
185+
186+ const model = AvroToMetaModel ( av ) ;
187+
188+ expect ( model ) . not . toBeUndefined ( ) ;
189+ expect ( model instanceof StringModel ) . toBeTruthy ( ) ;
190+ } ) ;
191+ test ( 'should handle AvroSchema value of type bytes' , ( ) => {
192+ const av = new AvroSchema ( ) ;
193+ av . name = 'test' ;
194+ av . type = { name : 'test1' , type : 'bytes' } ;
195+
196+ const model = AvroToMetaModel ( av ) ;
197+
198+ expect ( model ) . not . toBeUndefined ( ) ;
199+ expect ( model instanceof StringModel ) . toBeTruthy ( ) ;
200+ } ) ;
181201 test ( 'should handle AvroSchema value of type' , ( ) => {
182202 const av = new AvroSchema ( ) ;
183203 av . name = 'test' ;
You can’t perform that action at this time.
0 commit comments