[pull] master from glideapps:master#74
Merged
Merged
Conversation
…mments (#2670) Passing leadingComments (even []) to the quicktype-core API skipped GolangRenderer's whole single-file header block, including the consolidated top-of-file import collection, so a lazily-emitted `import "time"` for date-time fields landed mid-file, producing invalid Go. leadingComments now only replaces the default header comment, matching the pattern used by other language renderers, while imports are always consolidated at the top of the file. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
The Python generator collapsed JSON Schema string formats "date" and "time" onto the same "date-time" transformed-string kind, so all three were emitted as datetime.datetime and serialized with .isoformat(), producing a full ISO datetime string for date-only and time-only values. This violated the input schema on round-trip. Keep "date" and "time" as distinct transformed-string kinds through the Python stringTypeMapping, and teach PythonRenderer/ JSONPythonRenderer to emit datetime.date/datetime.time (with dedicated from_date/from_time parsing helpers) instead of always using datetime.datetime. Test coverage: strengthened test/fixtures/python/main.py to assert that generated instances have the correct runtime types (datetime.date/datetime.time/datetime.datetime) for schemas with date/time/date-time properties; this is exercised by the existing test/inputs/schema/date-time.schema fixture, run via `QUICKTEST=true FIXTURE=schema-python script/test`. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Draft-07+ JSON Schema allows a subschema to be the literal boolean `false`, meaning "nothing is valid here" (e.g. to disallow a property in a particular oneOf branch). quicktype's schema input unconditionally rejected this with "Schema \"false\" is not supported", aborting codegen entirely for real-world schemas that use the pattern (such as the Amazon Selling Partner Listings Feed schema from the issue). `false` subschemas now map to quicktype's existing "none" primitive type, the same mechanism already used for empty unions; a later pass (noneToAny) converts it to "any" before rendering. `items: false` is now also accepted the same way properties are. Intersections (allOf) treat "none" as absorbing, matching normal empty-type semantics. Added test/inputs/schema/boolean-subschema.schema (+ .1.json sample) covering false as a property value, as items, and inside allOf. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
typing.Type was only added to the standard library in 3.5.3/3.6.1, so it does not exist on Python 3.6.0. The --python-version 3.6 preset enables type hints and unconditionally emitted `Type[T]` (imported from typing) as the parameter type hint for the c parameter of the generated to_class/to_enum/is_type helpers, breaking generated code on 3.6.0. Add a typingType PythonFeatures flag (false for 3.5/3.6, true for 3.7+) and only emit the Type[T] annotation when it is set, leaving all other type hints for 3.6 intact and 3.7+ output unchanged. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Kotlin's base renderer (used by --just-types) emitted bare enum constants, dropping the original JSON string associated with each case. Every other Kotlin framework (Klaxon, Jackson, kotlinx) and Java's --just-types already preserve this value, making --just-types Kotlin enums an inconsistent, lossy outlier. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
getProtocolsArray unconditionally dropped Sendable whenever objcSupport was enabled, even for enums and structs that have no NSObject/objc interop concern. Drop that guard, and for classes emit `final` (Swift requires NSObject subclasses to be final and immutable to be Sendable) whenever sendable is on and properties are immutable. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Rust's emitLeadingComments() assumed at least one top-level type exists to name in its example-usage comment, panicking with "Defined value expected, but got undefined" whenever this.topLevels was empty. This is legitimate, reachable state: TypeScript sources without a #TopLevel marker (the common case) fall back to uris: ["#/definitions/"], producing a non-empty type graph with zero named top levels. Now the renderer simply skips the top-level-specific example comment when there is nothing to name. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Piping quicktype's output into a program that closes the pipe early (e.g. `... | head -n 4`) left an unhandled 'error' event on process.stdout/stderr. Node treated the resulting EPIPE as an uncaught exception, printing a raw stack trace and exiting with code 1 instead of exiting quietly like well-behaved Unix CLIs do. Add EPIPE error handlers on process.stdout/stderr in the CLI entry point that exit(0) on EPIPE and rethrow any other stream error. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
The Rust renderer's breakCycle wrapped an extra outer Box around a field whose type is a nullable union that is itself a cycle breaker, producing Box<Option<Box<T>>> instead of Option<Box<T>>. The union rendering path already boxes its cycle-breaking member, so the field-level Box was redundant. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
With --datetime-provider legacy, JavaJacksonRenderer switched on the raw property type kind to decide whether to add @jsonformat. Required date/date-time/time properties have that kind directly, but optional properties are represented as a nullable union, so the switch fell through and the annotation was silently omitted, producing inconsistent serialization between required and optional fields of the same format. Unwrap a nullable union to its non-null member (matching the pattern already used in JavaRenderer.javaType) before switching on the kind. Added test/inputs/schema/optional-date-time.schema (+ .1.json sample) with matching required/optional date, time, and date-time properties, exercised by the existing schema-java-datetime-legacy fixture. Fixes #1593 Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…onal (#1961) Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…mit-empty (#2515) When a oneOf branch unification makes a nullable/union-typed property optional, --omit-empty tagged it json:"field,omitempty". Since Go's omitempty on a pointer conflates "absent" with an explicit JSON null, this silently dropped required null values (e.g. {"kind":"one","b":null}) from marshalled output, producing schema-invalid JSON. canOmitEmpty already excluded union/null/any-typed properties from omitempty in the default (flag-off) path; --omit-empty unconditionally bypassed that exclusion. Now the exclusion applies regardless of the flag, while --omit-empty still widens omitempty to other optional property types as intended. Added test/inputs/schema/nullable-optional-one-of.schema (a oneOf where one variant requires a nullable property, the other doesn't) run with omit-empty via GoLanguage.quickTestRendererOptions, and updated the existing omit-empty fixture's expected output to reflect that nullable fields now preserve null instead of being dropped. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…3057) Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…3040) Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Reformat the scalarUnion schema literal to Biome's canonical layout and move the "method found" assertion out of the validationMethod helper (noMisplacedAssertion) by throwing instead, so `npm run lint` passes. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The new rust-cycle-breaker-union.schema (a self-referential union member, i.e. a union whose member recursively refers back to the enclosing object) crashes cJSON's multi-source renderer with an internal error during generation. This is a pre-existing cJSON limitation, unrelated to the Rust double-boxing fix this schema was added to cover; all other languages generate valid, round-tripping code. Scope the schema out for cjson. Co-Authored-By: Claude <noreply@anthropic.com>
The bare boolean-subschema.1.fail.json ran for every language but relied
on a type violation (object supplied for the string 'foo') that Jackson
leniently coerces to "", so kotlin/schema-kotlin did not reject it and
the round-trip produced {"empty":[],"foo":""} instead of failing.
Replace it with a scalar supplied for the required 'empty' array, which
every target's deserializer rejects (no language coerces a scalar into a
list): verified via the real fixture harness for schema-golang and
schema-python, and manually for go/rust/python generated code.
Co-Authored-By: Claude <noreply@anthropic.com>
KotlinX renders unions as sealed classes without serializer wiring, so deserialization of polymorphic union members fails at runtime with "Class discriminator was missing" (a pre-existing, documented KotlinX limitation shared by ~15 other union schemas already skipped in KotlinXLanguage.skipSchema). The new rust-cycle-breaker-union.schema hits the same limitation; scope it out for kotlinx like the others. Co-Authored-By: Claude <noreply@anthropic.com>
…a on cjson (#2515) The .1.fail.enum.json sample added in #3057 relies on the generated code rejecting an invalid "kind" enum value, but cjson's enum decoder silently falls back to the first variant instead of failing. Add the schema to the existing skipsEnumValueValidation list, which already covers this same gap for cjson/crystal/swift/haskell/typescript-zod/typescript-effect-schema. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…ped values (#1961) The PR's updated optional-any.schema fixture added a required bar:boolean property with a .fail.json negative sample containing a string for bar. Without strict_types, PHP weakly coerces the string into a bool instead of throwing, so the generated PHP program didn't fail as the fixture expects. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
PR #898 (merged after #2357) fixed enum case ordering to preserve JSON Schema declaration order instead of the previous incidental alphabetical order. test/unit/cjson-enum-default.test.ts, added by #2357, still asserted the old alphabetical order (CONFIG, HEARTBEAT, STATE) and started failing on master once #898 landed. Update the expectation to the correct, now-declaration-order output (STATE, CONFIG, HEARTBEAT), matching the schema's enum: ["state", "config", "heartbeat"]. Co-Authored-By: Claude <noreply@anthropic.com>
…rder (#undefined) Merging master (which has moved substantially, including #1289 which stopped ConvenienceRenderer.forEachEnumCase from alphabetizing enum cases) into this branch surfaced a pre-existing, unrelated master-side unit test failure: test/unit/cjson-enum-default.test.ts still asserted the old alphabetical enum-case order, but cjson (like every other language) now preserves JSON Schema declaration order. Update the expected string to match; no renderer/core code changes. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…alidation gap (#3004) Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
Elm type aliases cannot be recursive (documented at the top of ElmLanguage.skipSchema, and already applied to mutually-recursive.schema, recursive-union-flattening.schema, etc). The generated decoder/encoder for the new rust-cycle-breaker-union.schema forms a genuinely cyclic top-level value definition (`next` depends on `nodeClass` depends on `next`), which elm make rejects with a CYCLIC DEFINITION error since it isn't wrapped in Jdec.lazy. Scope the schema out for elm like the other recursive schemas. Co-Authored-By: Claude <noreply@anthropic.com>
Bring the branch up to date with master so CI (which tests the PR-head/master merge) reflects current mainline state.
…ed at runtime)
The PR's new optional-any.3.fail.json case (bar given as a string where the
schema requires boolean) relies on scalar-type validation during decode.
Elixir's generated from_map/1 does raw, unchecked field assignment, so it
already skips strict-optional.schema/required.schema/intersection.schema for
the same documented reason ("Struct keys cannot be enforced at runtime in
Elixir"). Add optional-any.schema to that same skip group.
Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
test/unit/cjson-enum-default.test.ts, pulled in by merging master, expected alphabetical enum-case order, but quicktype preserves JSON Schema declaration order for enum cases in cJSON (and every other language). Update the expectation to match actual generator output. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…cking (#3004) Elixir's generated from_map/1 assigns JSON fields directly with no type validation (same pre-existing, already-documented limitation that already excludes strict-optional.schema and required.schema for this language), so the new boolean-subschema.1.fail.json type-mismatch case can't be enforced. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
…ation (#3004) test/fixtures/haskell/Main.hs unconditionally encodes the decoded Maybe result, so a failed decode prints "null" and exits 0 (same pre-existing, already-documented limitation that already excludes nested-intersection-union.schema and prefix-items.schema for this language), so the new boolean-subschema.1.fail.json case can't be detected. Co-Authored-By: gpt-5.6-sol via pi <noreply@openai.com>
fix(cli): exit cleanly instead of crashing on EPIPE
fix(java): emit @jsonformat for optional date/time properties
fix(rust): stop double-boxing nullable cycle-breaking unions
fix(cpp): compile optional any-typed properties with --hide-null-optional
fix(schema): support boolean "false" subschemas
fix(golang): always emit consolidated imports regardless of leadingComments
fix(python): use datetime.date/time for date/time formats
fix(csharp): make generated Serialize/Converter classes partial
fix(rust): don't panic when there are no top-level types
fix(swift): allow Sendable conformance with objective-c-support
fix(python): drop typing.Type dependency for Python 3.6 target
fix(kotlin): preserve enum string values in --just-types mode
fix(php): stop re-checking scalar types PHP already enforces
fix(golang): don't apply omitempty to nullable/union fields under --omit-empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )