fork of hey-api/openapi-ts because I need some additional things

fix: correct additionalProperties condition in all Zod plugin versions

- Changed from Object.keys(properties) to Object.keys(schema.properties)
- Added ZodType for circular references in v4 plugin
- Removed type === 'object' restriction for additionalProperties
- Applied consistent fixes across v3, v4, and mini plugin versions

MaxwellAt 9556d52f 6eefbf64

Changed files
+21 -7
packages
openapi-ts
src
plugins
zod
+1 -1
README.md
··· 1 - packages/openapi-ts/README.md 1 + packages/openapi-ts/README.md
+1 -2
packages/openapi-ts/src/plugins/zod/mini/plugin.ts
··· 469 469 470 470 if ( 471 471 schema.additionalProperties && 472 - schema.additionalProperties.type === 'object' && 473 - !Object.keys(properties).length 472 + (!schema.properties || !Object.keys(schema.properties).length) 474 473 ) { 475 474 const zodSchema = schemaToZodSchema({ 476 475 plugin,
+1 -2
packages/openapi-ts/src/plugins/zod/v3/plugin.ts
··· 391 391 392 392 if ( 393 393 schema.additionalProperties && 394 - schema.additionalProperties.type === 'object' && 395 - !Object.keys(properties).length 394 + (!schema.properties || !Object.keys(schema.properties).length) 396 395 ) { 397 396 const zodSchema = schemaToZodSchema({ 398 397 plugin,
+18 -2
packages/openapi-ts/src/plugins/zod/v4/plugin.ts
··· 431 431 432 432 if ( 433 433 schema.additionalProperties && 434 - schema.additionalProperties.type === 'object' && 435 - !Object.keys(properties).length 434 + (!schema.properties || !Object.keys(schema.properties).length) 436 435 ) { 437 436 const zodSchema = schemaToZodSchema({ 438 437 plugin, ··· 458 457 if (zodSchema.hasCircularReference) { 459 458 result.hasCircularReference = true; 460 459 } 460 + 461 + // Return with typeName for circular references 462 + if (result.hasCircularReference) { 463 + return { 464 + ...result, 465 + typeName: 'ZodType', 466 + } as ZodSchema; 467 + } 468 + 461 469 return result as Omit<ZodSchema, 'typeName'>; 462 470 } 463 471 ··· 468 476 }), 469 477 parameters: [ts.factory.createObjectLiteralExpression(properties, true)], 470 478 }); 479 + 480 + // Return with typeName for circular references (AnyZodObject doesn't exist in Zod v4, use ZodType) 481 + if (result.hasCircularReference) { 482 + return { 483 + ...result, 484 + typeName: 'ZodType', 485 + } as ZodSchema; 486 + } 471 487 472 488 return result as Omit<ZodSchema, 'typeName'>; 473 489 };