Skip to content

feat: Add support for unevaluatedProperties in JSON Schema#2800

Merged
schani merged 4 commits into
glideapps:masterfrom
haya14busa:fix-unevaluated-properties-support
Jul 20, 2026
Merged

feat: Add support for unevaluatedProperties in JSON Schema#2800
schani merged 4 commits into
glideapps:masterfrom
haya14busa:fix-unevaluated-properties-support

Conversation

@haya14busa

@haya14busa haya14busa commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for the unevaluatedProperties keyword from JSON Schema draft 2019-09/2020-12.

Problem

When using JSON Schema with unevaluatedProperties, quicktype was generating incorrect types. For example, in Go, it would generate map[string]interface{} instead of properly typed maps like map[string][]SomeType.

Solution

When additionalProperties is not defined in a schema, quicktype now falls back to using unevaluatedProperties to determine the type of additional properties in an object.

Changes

  • Modified JSONSchemaInput.ts to handle unevaluatedProperties when additionalProperties is undefined
  • Added test cases with JSON Schema using unevaluatedProperties

Test

Added test schema and data files:

  • test/inputs/schema/unevaluated-properties.schema
  • test/inputs/schema/unevaluated-properties.1.json
  • test/inputs/schema/unevaluated-properties.2.json

The tests can be run with:

QUICKTEST=true FIXTURE=schema-golang npm test

Example

Before this fix:

type ChecksumConfig struct {
    EmbeddedChecksums map[string]interface{} `json:"embedded_checksums,omitempty"`
}

After this fix:

type ChecksumConfig struct {
    EmbeddedChecksums map[string][]EmbeddedChecksum `json:"embedded_checksums,omitempty"`
}

Add support for the unevaluatedProperties keyword from JSON Schema draft 2019-09/2020-12.
When additionalProperties is not defined, unevaluatedProperties is now used as a fallback
to determine the type of additional properties in an object.

This fixes issues where objects using unevaluatedProperties would generate incorrect
types (e.g., map[string]interface{} instead of properly typed maps in Go).
@haya14busa
haya14busa force-pushed the fix-unevaluated-properties-support branch from dd63fbd to af0c9ff Compare July 5, 2025 13:32
schani and others added 3 commits July 20, 2026 10:21
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A map<string, Item[]> and a map<string, any> round-trip the positive
samples identically, so add an expected-failure sample with a mistyped
map value. Languages that don't reject mistyped map values skip it via
a new shared skipsMapValueValidation list, which also absorbs the
existing go-schema-pattern-properties.schema entries — the same
failure mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@schani
schani merged commit 044ed8d into glideapps:master Jul 20, 2026
50 of 112 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants