How to Preserve Exact Field Capitalization in OpenAPI Schema #2341
Replies: 1 comment
-
If there is no way to achieve this, is there an alternative approach to replicate the behavior when Here is the behavior I am referring to: Jackson uses the class getters and setters to map attributes. When it encounters a field that starts with an uppercase letter, it will convert all leading uppercase letters to lowercase until it reaches the first lowercase letter. For example, given a field named So, the request would look like this: {
"policyPlatType": "...",
"somepolicy": "..."
}
Is there any way to replicate this behavior in OpenAPI so that we can maintain naming consistency between the documentation and the Jackson deserialization behavior? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Java model like this:
When I generate the OpenAPI schema from this class, I get:
The problem is that the Java field is SOMEPolicy, but the generated OpenAPI schema uses sOMEPolicy. This creates an inconsistency between the documentation and the expected content of the requests.
The request is done as:
What I’m looking for is the OpenAPI equivalent of:
In other words, how can I configure the OpenAPI so that the field is consistently represented as SOMEPolicy instead of sOMEPolicy?
I want to do this without annotations and changes on the class code. Is there any way in which this can be done?
Beta Was this translation helpful? Give feedback.
All reactions