-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The attribute parameters readOnly and writeOnly are ignored when generating jackson JsonProperty annotation.
openapi-generator version
5.0.1
OpenAPI declaration file content or url
"Example": {
"type": "object",
"properties": {
"displayName_r": {
"type": "string",
"readOnly": true
},
"displayName_w": {
"type": "string",
"writeOnly": true
}
}
},Generation Details
<generatorName>jaxrs-spec</generatorName>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<returnResponse>false</returnResponse>
<sourceFolder>java</sourceFolder>
<useSwaggerAnnotations>false</useSwaggerAnnotations>
<generatePom>false</generatePom>
<dateLibrary>java8</dateLibrary>
</configOptions>
Steps to reproduce
- Generate Code
- Check contents of generated
Example.java-> usages ofJsonPropertydo not defineaccess
Related issues/PRs
none
Suggest a fix
Update pojo.mustache to use
@JsonProperty(value = "{{baseName}}"{{#isReadOnly}}, access = JsonProperty.Access.READ_ONLY{{/isReadOnly}}{{#isWriteOnly}}, access = JsonProperty.Access.WRITE_ONLY{{/isWriteOnly}})
instead of
@JsonProperty("{{baseName}}")
Reactions are currently unavailable