[pull] master from glideapps:master#69
Merged
Merged
Conversation
Signed-off-by: Aysajan Eziz <aeziz@northset.ai>
The previous commit only applied the output-filename-derived module name
to the TypeScript usage import comment; JavaScript (and Flow, which
inherits it) still emitted require("./file"). Hoist the module-name
derivation into a shared usageModuleName helper on JavaScriptRenderer,
use it in both the JavaScript require comment and the TypeScript import
comment, and extend the unit test to cover JavaScript, Flow, and the
stdout fallback.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fix: use output filename in TypeScript usage imports
JSON Schema draft 2020-12 renamed the array (tuple) form of `items` to `prefixItems`, which is now emitted by Pydantic v2 and Rust's schemars. `makeArrayType()` only read `schema.items`, so a `prefixItems`-based tuple fell through to the generic `any[]` branch and lost its member types; with `--just-types` and a top-level array that produced no output at all. `prefixItems` was also missing from the `needUnion` type-inference predicate. Apply the existing array-form `items` tuple-union logic to `schema.prefixItems` as well, and add `prefixItems` to the type-inference predicate. When `prefixItems` is absent, array handling is unchanged. Adds test/unit/prefix-items-schema.test.ts, which fails before this change and passes after. Fixes #2811
Two follow-ups to the prefixItems tuple support: - In 2020-12, an object-form `items` next to `prefixItems` describes the rest elements of an open tuple. It was previously dropped; now its type joins the tuple's element union (quicktype models tuples as arrays of a union of the member types). Boolean `items` (`false` closes the tuple, `true` allows anything) is still ignored. - Add `test/inputs/schema/prefix-items.schema` so the feature is covered by the end-to-end fixture tests, mirroring `tuple.schema` but with 2020-12 `prefixItems`, plus an open tuple that also has a rest `items` schema. The `.fail.union.json` sample has a tuple element outside the declared union, so validating languages must reject it — it would be accepted if the tuple degraded to `any[]`, which is exactly the regression this guards against. The unit test keeps only what fixtures cannot express (that `$ref`d member types survive into the generated code) and gains a case for the prefixItems-plus-rest-items union. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The generated cJSON deserializer silently drops array elements whose type is outside the union instead of aborting parsing, so the prefix-items.1.fail.union.json expected-failure sample does not fail. This is the already-documented "Union, Map and Arrays with invalid types are not checked" limitation; add the schema to that skip group. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both test drivers exit 0 on a failed decode (scala3 prints the circe DecodingFailure, haskell encodes the Maybe result as null), so the prefix-items.1.fail.union.json expected-failure sample cannot be detected. Same documented limitation as nested-intersection-union.schema. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…chema Handle JSON Schema 2020-12 prefixItems tuples
The badge pointed at the deleted master.yaml workflow (and the old quicktype/quicktype repo path); point it at test-pr.yaml on master and make it link to the workflow runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The kotlinx framework of the Kotlin renderer had no end-to-end fixture coverage at all — only klaxon (kotlin/schema-kotlin) and jackson (kotlin-jackson/schema-kotlin-jackson) were tested. This adds kotlinx and schema-kotlinx fixtures: - test/fixtures/kotlinx/: driver that round-trips JSON through the generated @serializable types with kotlinx-serialization-json (runtime jars vendored like the klaxon/jackson jars; the compiler plugin ships with the Kotlin distribution). - KotlinXLanguage entry in test/languages.ts with skips for what the kotlinx renderer genuinely cannot do yet, all verified by compiling and round-tripping every input locally: - unions render as sealed classes with no serializer wiring (documented TODO in KotlinXRenderer.ts), so union inputs are skipped and the "union" feature is not claimed; - top-level arrays render as `typealias TopLevel = JsonArray<T>`, which does not compile; - astral-plane characters in property names are emitted as 5-hex-digit \u escapes in @SerialName, which Kotlin misparses. - CI matrix entry kotlinx,schema-kotlinx on the 16-core runner. Compared to the klaxon fixtures this also enables inputs klaxon cannot handle: simple-identifiers.json, no-classes.json, bug427.json, and the any, uuid, keyword-enum, top-level-enum, top-level-primitive, nested-intersection-union, and go-schema-pattern-properties schemas. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add fixture coverage for Kotlin kotlinx-serialization
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 : )