From cb2fb8b07bc33164691ec30b79ef7637e4fc8eda Mon Sep 17 00:00:00 2001 From: EloB <476567+EloB@users.noreply.github.com> Date: Sun, 15 Nov 2026 07:48:39 +0100 Subject: [PATCH 1/2] test(java): run optional-date-time.schema with the legacy date-time provider `schema-java-datetime-legacy` runs this schema, but CI's Java job runs only `java,schema-java`. A quick-test entry runs it in `schema-java` with `datetime-provider: legacy`, including the expected-failure sample `optional-date-time.1.fail.date-time.json`, which that provider accepts. Co-Authored-By: Claude Opus 5.5 --- test/languages.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/languages.ts b/test/languages.ts index 8f534c31d..8369f5a35 100644 --- a/test/languages.ts +++ b/test/languages.ts @@ -246,9 +246,15 @@ export const JavaLanguage: Language = { skipMiscJSON: false, skipSchema: ["optional-property.schema"], rendererOptions: {}, - // The default is array-type=list; this keeps the T[] code path - // covered. - quickTestRendererOptions: [{ "array-type": "array" }], + quickTestRendererOptions: [ + // The default is array-type=list; this keeps the T[] code path + // covered. + { "array-type": "array" }, + // CI runs schema-java, not schema-java-datetime-legacy: this runs + // the legacy provider's date and time parsing, including the + // expected-failure sample. + ["optional-date-time.schema", { "datetime-provider": "legacy" }], + ], sourceFiles: ["src/language/Java/index.ts"], }; From 2899bb32c7268dc6c821be5c85dd4716433e6555 Mon Sep 17 00:00:00 2001 From: EloB <476567+EloB@users.noreply.github.com> Date: Sun, 15 Nov 2026 07:50:40 +0100 Subject: [PATCH 2/2] fix(java): reject unparseable dates with the legacy date-time provider `parseAllDateTimeString` returned `null` when no format matched, so an invalid date, time or date-time property was read as `null` instead of being rejected (`optional-date-time.1.fail.date-time.json` was accepted). Throw `IllegalArgumentException`, as the `java8` provider's parsers throw. Co-Authored-By: Claude Opus 5.5 --- packages/quicktype-core/src/language/Java/DateTimeProvider.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/quicktype-core/src/language/Java/DateTimeProvider.ts b/packages/quicktype-core/src/language/Java/DateTimeProvider.ts index 2535fcdfa..ffd2e1b86 100644 --- a/packages/quicktype-core/src/language/Java/DateTimeProvider.ts +++ b/packages/quicktype-core/src/language/Java/DateTimeProvider.ts @@ -272,7 +272,9 @@ export class JavaLegacyDateTimeProvider extends JavaDateTimeProvider { }); }, ); - this._renderer.emitLine("return null;"); + this._renderer.emitLine( + 'throw new IllegalArgumentException("Unparseable date: " + str);', + ); }, );