File tree Expand file tree Collapse file tree
tools/openapi-resource-gen/src/generators/api-resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ function collectEnumExtensions(params: OpenAPIV3.ParameterObject[]): EnumExtensi
142142 'x-enum-varnames' ?: string [ ] ;
143143 'x-enum-descriptions' ?: string [ ] ;
144144 } ) | undefined ;
145+ if ( ! schema ) continue ;
145146 // OAS 3.1 uses const: value for a single fixed value; treat as a single-element enum.
146147 const constVal = ( schema as { const ?: unknown } ) . const ;
147148 const rawValues : unknown [ ] | undefined = Array . isArray ( schema . enum )
@@ -287,16 +288,17 @@ export function buildEndpoints(
287288 if ( primarySchema ) {
288289 // OAS 3.1 allows type to be an array (e.g. ['array', 'null']); isArrayType handles both forms.
289290 const schemaIsArray = isArrayType ( primarySchema . type ) ;
291+ const arraySchema = primarySchema as OpenAPIV3 . ArraySchemaObject ;
290292 discriminator =
291293 extractDiscriminatorFromSchema ( primarySchema , false ) ??
292294 ( schemaIsArray
293- ? extractDiscriminatorFromSchema ( primarySchema . items as OpenAPIV3 . SchemaObject , true )
295+ ? extractDiscriminatorFromSchema ( arraySchema . items as OpenAPIV3 . SchemaObject , true )
294296 : null ) ;
295297 if ( schemaIsArray ) {
296298 responseIsArray = true ;
297299 // items may be absent for OAS 3.1 tuple schemas using prefixItems; skip date collection.
298- dateFields = primarySchema . items
299- ? collectDateFields ( primarySchema . items as OpenAPIV3 . SchemaObject )
300+ dateFields = arraySchema . items
301+ ? collectDateFields ( arraySchema . items as OpenAPIV3 . SchemaObject )
300302 : [ ] ;
301303 } else {
302304 dateFields = collectDateFields ( primarySchema ) ;
You can’t perform that action at this time.
0 commit comments