Repository navigation
Property Naming
A JSON property key and a Java field name are not the same thing. ModelMaker normalizes the key to a camelCase
identifier, keeps the original key for JSON binding, and rejects anything ambiguous up front instead of leaving
javac to complain.
A key must match one of these forms, optionally prefixed with one or more underscores (e.g. __metadata):
| Form | Example | Regex (after the underscore prefix) |
|---|---|---|
camelCase |
firstName |
[a-z][a-zA-Z0-9]* |
snake_case |
first_name |
[a-z][a-z0-9]*(_[a-z0-9]+)* |
UpperCamelCase |
FirstName |
[A-Z][a-zA-Z0-9]* |
-
snake_casesegments are joined and capitalized. - An
UpperCamelCasekey is lower-cased on its first letter. - A leading-underscore prefix is kept as-is.
| Key | Field name |
|---|---|
firstName |
firstName |
first_name |
firstName |
FirstName |
firstName |
_first_name |
_firstName |
__metadata |
__metadata |
The original key is preserved for @JsonProperty and @JsonPropertyOrder, so the wire format is exactly what the
schema said:
"first_name": { "type": "string" }private final @Nullable String firstName;
@JsonProperty("first_name")
public @Nullable String getFirstName() {
return firstName;
}The getter, builder method and wither names come from the field name with its first letter capitalized:
| Field | Getter | Builder method | Wither |
|---|---|---|---|
firstName |
getFirstName() |
firstName(...) |
withFirstName(...) |
_firstName |
get_firstName() |
_firstName(...) |
with_firstName(...) |
An underscore-prefixed field therefore yields valid Java that is not a JavaBeans-style accessor. Tooling that relies on bean introspection (rather than on the emitted Jackson annotations) may not see such a property.
| Rejected | Why |
|---|---|
name_, first__name
|
Trailing or doubled underscore inside the body. |
kebab-case, with space, 1st
|
Matches none of the accepted forms. |
first_name and firstName in the same object |
Both normalize to firstName. |
_first_name and _firstName in the same object |
Both normalize to _firstName. |
The clash check is per object, so a nested type may reuse a name freely. Exact error messages are on Troubleshooting.
- Pick one key style per schema and stay with it - the generated Java is identical either way, only the JSON differs.
- Use the underscore prefix only when the wire format genuinely has one; the resulting accessors are awkward.
-
$ref,type,titleand friends are schema keywords, not property keys - they live one level up, inside the property object, never as a property name.
ModelMaker - Apache License 2.0 - Issues - Wiki index
Start here
Schemas
Output
Features
Integration
Reference