@@ -23,6 +23,7 @@ import {
23
23
} from '../../common/data/serialized-type' ;
24
24
import {
25
25
AllOfSchemaObjectCodec ,
26
+ ArraySchemaObject ,
26
27
ConstSchemaObjectCodec ,
27
28
EnumSchemaObjectCodec ,
28
29
ObjectSchemaObject ,
@@ -36,7 +37,7 @@ import { ReferenceObject, ReferenceObjectCodec } from '../../../../schema/asynca
36
37
import { traverseNEAEither } from '../../../../utils/either' ;
37
38
import { constFalse } from 'fp-ts/lib/function' ;
38
39
import { sequenceEither } from '@devexperts/utils/dist/adt/either.utils' ;
39
- import { none , Option } from 'fp-ts/lib/Option' ;
40
+ import { Option } from 'fp-ts/lib/Option' ;
40
41
41
42
export const serializeSchemaObject = (
42
43
from : Ref ,
@@ -85,7 +86,7 @@ const serializeSchemaObjectWithRecursion = (
85
86
return serializeObjectSchemaObject ( from , schemaObject , shouldTrackRecursion , name ) ;
86
87
}
87
88
case 'array' : {
88
- return serializeArray ( from , schemaObject . items , shouldTrackRecursion , name ) ;
89
+ return serializeArray ( from , schemaObject , shouldTrackRecursion , name ) ;
89
90
}
90
91
}
91
92
} ;
@@ -185,12 +186,12 @@ const serializeProperties = (
185
186
186
187
const serializeArray = (
187
188
from : Ref ,
188
- items : ReferenceObject | SchemaObject ,
189
+ schemaObject : ArraySchemaObject ,
189
190
shouldTrackRecursion : boolean ,
190
191
name ?: string ,
191
192
) : Either < Error , SerializedType > => {
192
- const serialized = ReferenceObjectCodec . is ( items )
193
- ? pipe ( fromString ( items . $ref ) , either . map ( getSerializedRefType ( from ) ) )
194
- : serializeSchemaObjectWithRecursion ( from , items , false ) ;
195
- return pipe ( serialized , either . map ( getSerializedArrayType ( none , name ) ) ) ;
193
+ const serialized = ReferenceObjectCodec . is ( schemaObject . items )
194
+ ? pipe ( fromString ( schemaObject . items . $ref ) , either . map ( getSerializedRefType ( from ) ) )
195
+ : serializeSchemaObjectWithRecursion ( from , schemaObject . items , false ) ;
196
+ return pipe ( serialized , either . map ( getSerializedArrayType ( schemaObject . minItems , name ) ) ) ;
196
197
} ;
0 commit comments