Skip to content

feat(typescript-zod): validate additional properties - #3111

Open
louis-bompart wants to merge 3 commits into
glideapps:masterfrom
coveord:agent/typescript-zod-additional-properties
Open

louis-bompart wants to merge 3 commits into
glideapps:masterfrom
coveord:agent/typescript-zod-additional-properties

Conversation

@louis-bompart

@louis-bompart louis-bompart commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Preserve JSON Schema additionalProperties behavior in TypeScript Zod output using Zod 3/4-compatible object methods.

Related Issue

N/A

Motivation and Context

TypeScript Zod previously discarded unknown-key semantics and converted objects with typed additional properties into broad maps. This change preserves fixed object properties and validates unknown keys according to the source schema.

Previous Behaviour / Output

z.object({
    "value": z.string(),
})

New Behaviour / Output

z.object({
    "value": z.string(),
}).strict()

Depending on additionalProperties, generated schemas now use .strict(), .passthrough(), or .catchall(...).

How Has This Been Tested?

  • npm run test:unit -- test/unit/typescript-zod-additional-properties.test.ts
  • QUICKTEST=true FIXTURE=schema-typescript-zod npm run test:fixtures -- test/inputs/schema/class-with-additional.schema

The unit test asserts all three generated Zod forms. The existing schema fixture accepts a typed additional boolean property and rejects an invalid string value.

Screenshots (if appropriate):

N/A

@louis-bompart
louis-bompart marked this pull request as ready for review August 4, 2026 20:57
…zod-additional-properties

# Conflicts:
#	packages/quicktype-core/src/language/TypeScriptZod/TypeScriptZodRenderer.ts
@github-actions

Copy link
Copy Markdown

Generated-output differences

295 files differ — 295 modified, 0 new, 0 deleted
4208 changed lines — +2123 / −2085

Open the generated-output report →

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant