You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Complete error message format consistency - add quotes to property names #105
changed the title [-]Simplify enum deduplication logic in JtdPropertyTest[/-][+]Complete error message format consistency - add quotes to property names[/+]on Sep 28, 2025
Analysis of Current State (main branch after PR #117 merge)
Finding: Issue Appears Already Completed ✅
Looking at the current code in json-java21-jtd/src/main/java/json/java21/jtd/Jtd.java (lines 745-786), the error messages already follow the consistent pattern described in this issue:
Error messages WITH single quotes around user-provided values:
Error Type
Template
UNKNOWN_TYPE
"unknown type: '%s'"
VALUE_NOT_IN_ENUM
"value '%s' not in enum: %s"
MISSING_REQUIRED_PROPERTY
"missing required property: '%s'"
ADDITIONAL_PROPERTY_NOT_ALLOWED
"additional property not allowed: '%s'"
DISCRIMINATOR_MUST_BE_STRING
"discriminator '%s' must be a string"
DISCRIMINATOR_VALUE_NOT_IN_MAPPING
"discriminator value '%s' not in mapping"
Error messages WITHOUT quotes (correct - these report Java class names/keywords, not user values):
Error Type
Template
EXPECTED_BOOLEAN
"expected boolean, got %s"
EXPECTED_STRING
"expected string, got %s"
etc.
Test Coverage Verified
Tests in TestValidationErrors.java confirm the quoted format:
Line 151: assertThat(...).contains("missing required property: 'age'");
Line 173: assertThat(...).contains("additional property not allowed: 'extra'");
Recommendation
This issue can be closed - the changes described in the issue body are already implemented in the current main branch. The pattern is consistent: user-provided values (property names, type names, enum values) get single quotes, while Java type keywords don't.
All usage sites conform: Jtd.java:149,168 pass property-name keys into quoted slots. Every %%s receiving instance.getClass().getSimpleName() (JtdSchema.java:130-521) is an unquoted Java class name slot; every scalar user value (type, property name, enum value, discriminator key/value) lands in a quoted slot.
Compile-time messages in Jtd.java also consistent: quoted user values — unknown type name (:512), unknown key in type schema (:498), non-existent ref (:586?), property/optionalProperties key overlap (:~640), discriminator mapping keys (:627-686); unquoted keywords and Java class names elsewhere.
Test coverage: TestValidationErrors.java asserts the quoted formats: line 151 "missing required property: 'age'", line 173 "additional property not allowed: 'extra'", line 101 "value 'yellow' not in enum", line 195 "discriminator 'type' must be a string", line 201 "discriminator value 'unknown' not in mapping", line 216 "unknown type: 'unknown-type'"; unquoted class-name formats asserted at lines 30-54 and 107-129.
Activity
[-]Simplify enum deduplication logic in JtdPropertyTest[/-][+]Complete error message format consistency - add quotes to property names[/+]simbo1905 commentedon Jan 26, 2026
Analysis of Current State (main branch after PR #117 merge)
Finding: Issue Appears Already Completed ✅
Looking at the current code in
json-java21-jtd/src/main/java/json/java21/jtd/Jtd.java(lines 745-786), the error messages already follow the consistent pattern described in this issue:Error messages WITH single quotes around user-provided values:
UNKNOWN_TYPE"unknown type: '%s'"VALUE_NOT_IN_ENUM"value '%s' not in enum: %s"MISSING_REQUIRED_PROPERTY"missing required property: '%s'"ADDITIONAL_PROPERTY_NOT_ALLOWED"additional property not allowed: '%s'"DISCRIMINATOR_MUST_BE_STRING"discriminator '%s' must be a string"DISCRIMINATOR_VALUE_NOT_IN_MAPPING"discriminator value '%s' not in mapping"Error messages WITHOUT quotes (correct - these report Java class names/keywords, not user values):
EXPECTED_BOOLEAN"expected boolean, got %s"EXPECTED_STRING"expected string, got %s"Test Coverage Verified
Tests in
TestValidationErrors.javaconfirm the quoted format:assertThat(...).contains("missing required property: 'age'");assertThat(...).contains("additional property not allowed: 'extra'");Recommendation
This issue can be closed - the changes described in the issue body are already implemented in the current main branch. The pattern is consistent: user-provided values (property names, type names, enum values) get single quotes, while Java type keywords don't.
simbo1905 commentedon Nov 21, 2026
Verified resolved on branch issue-168-port-jtd-esm-codegen (commit 13285c0).
Full audit of every error-message site in json-java21-jtd/src/main/java/json/java21/jtd/Jtd.java:
Error enum (Jtd.java:727-771) — every template checked, not just the two named in the issue:
Quoted (user-provided string values):
Unquoted (type keywords / Java class names — correct):
All usage sites conform: Jtd.java:149,168 pass property-name keys into quoted slots. Every %%s receiving instance.getClass().getSimpleName() (JtdSchema.java:130-521) is an unquoted Java class name slot; every scalar user value (type, property name, enum value, discriminator key/value) lands in a quoted slot.
Compile-time messages in Jtd.java also consistent: quoted user values — unknown type name (:512), unknown key in type schema (:498), non-existent ref (:586?), property/optionalProperties key overlap (:~640), discriminator mapping keys (:627-686); unquoted keywords and Java class names elsewhere.
Test coverage: TestValidationErrors.java asserts the quoted formats: line 151 "missing required property: 'age'", line 173 "additional property not allowed: 'extra'", line 101 "value 'yellow' not in enum", line 195 "discriminator 'type' must be a string", line 201 "discriminator value 'unknown' not in mapping", line 216 "unknown type: 'unknown-type'"; unquoted class-name formats asserted at lines 30-54 and 107-129.
Tests: mvn -pl json-java21-jtd test → BUILD SUCCESS, Tests run: 451, Failures: 0, Errors: 0, Skipped: 0 (TestValidationErrors 9/9 green).
Closing as fully resolved.