Identifiers
general
The processor will map identifiers used in the OpenAPI description (i.e. yaml
file) to valid Java
identifiers.
The Java identifiers will use camel case, starting with a upper case letter if it is a type name and a lower case letter if it is a variable name.
Camel case will be produced by detecting word breaks on special characters and using an upper case first letter on the next word. The special characters are:
-
characters that are not allowed in java identifiers (for example a
-
(minus)). This is checked by usingCharacter.isJavaIdentifierStart()
andCharacter.isJavaIdentifierPart()
-
_
(underscore). The underscore is possible in java identifiers but usually not used apart from enums.
model
For properties of model classes, the properties will be annotated with @JsonProperty
to provide
the mapping from the OpenAPI identifier to the Java identifier.
class Example {
@JsonProperty("foo-bar")
private String fooBar;
// ...
}
The Any json identifier gets converted to a valid java identifier. If it differs from the json identifier Spring (jackson) would be unable to correctly map the properties. To avoid this issue the processor adds the annotation. |