Skip to content

Commit

Permalink
Arrays without an items schema
Browse files Browse the repository at this point in the history
They can now use the new ANY type
  • Loading branch information
karlvr committed Jul 29, 2024
1 parent 8f4555b commit eab8dd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-keys-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openapi-generator-plus/core": minor
---

Add support for arrays without a specified items schema
6 changes: 1 addition & 5 deletions packages/core/src/process/schema/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ export function toCodegenArraySchema(apiSchema: OpenAPIX.SchemaObject, naming: S
throw new Error('Not an array schema')
}

if (!apiSchema.items) {
throw new Error('items missing for schema type "array"')
}

const vendorExtensions = toCodegenVendorExtensions(apiSchema)

/* Component properties are implicitly required as we don't expect to have `null` entries in the array. */
const componentSchemaUsage = toCodegenSchemaUsage(apiSchema.items, state, {
const componentSchemaUsage = toCodegenSchemaUsage(apiSchema.items || {}, state, {
required: true,
suggestedName: suggestedItemModelName,
purpose: CodegenSchemaPurpose.ARRAY_ITEM,
Expand Down

0 comments on commit eab8dd6

Please sign in to comment.