-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Description
Hi!
This issue is similar to the one mentioned here #20853 and I think a solution similar to #20947 should work (but for JavaJAXRSSpecServerCodegen). However, the issue is that whenever a schema has both properties and additional properties, the generated model extends HashMap but still adds properties as normal class attributes. This caused issued for me when mapping, excluding the attributes and only including the values inside HashMap. I've reproduced this multiple times in the latest version and master. You can reproduce it easily with,
a schema like,
Account:
type: object
description: A user account or resource representation
required:
- displayName
properties:
displayName:
type: string
description: Account display name
additionalProperties: true
and a command like openapi-generator-cli generate -i openapi-v3-7-18.yaml -g jaxrs-spec -o generated-code-7-18
(I've had additional properties in the command to change api and model packages)
Hope this gets fixed soon,
Thank you very much!
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- 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
openapi-generator version
v7.14.0
OpenAPI declaration file content or url
Generation Details
openapi-generator-cli generate -i openapi-v3-7-18.yaml -g jaxrs-spec -o generated-code-7-18
Steps to reproduce
- Create an openapi with a schema that has both properties and additional properties
- Use the generate command with jaxrs-spec
Related issues/PRs
Similar issue: #20853
Fix to that issue: #20947
Suggest a fix
Using @JsonAnySetter
/ @JsonAnyGetter
with a HashMap attribute to handle setting and getting should work, I believe.