[BUG][jaxrs-spec] Generated code is not valid with additionalProperties
Created by: trajano
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
Generated code is not valid. A schema that has additional properties generates
private @Valid LocalizedString name = new java.util.HashMap<>();
Which is not valid it should've been
private @Valid LocalizedString name = new LocalizedString();
openapi-generator version
4.0.3
OpenAPI declaration file content or url
LocalizedString:
description: |
An object containing all the translations for a given object. Each key represents an
[IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag.
type: object
title: Localized String
properties:
"und":
description: Represents `und`etermined which is used as the default when a more specialized version is not available.
type: string
additionalProperties:
x-additionalPropertiesName: language-tag
description: |
The key represents the [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag for clients to determine
what string to display.
type: string
example:
"und": "default locale"
"en": "English"
"en-CA": "Canadian English"
"en-US": "US English"
"zh": "Chinese"
"zh-CN": "China Chinese (Simplified)"
Command line used for generation
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<configOptions>
<apiPackage>com.devhaus.dlm.api</apiPackage>
<booleanGetterPrefix>is</booleanGetterPrefix>
<dateLibrary>java8</dateLibrary>
<fullJavaUtil>true</fullJavaUtil>
<invokerPackage>com.devhaus.dlm.api</invokerPackage>
<java8>true</java8>
<modelPackage>com.devhaus.dlm.api.model</modelPackage>
<useSwaggerAnnotations>false</useSwaggerAnnotations>
</configOptions>
<generatorName>jaxrs-spec</generatorName>
<inputSpec>${project.basedir}/src/main/resources/openapi.yml</inputSpec>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3388