Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit cbbec3b

Browse files
committed
Docs updated
1 parent b825c04 commit cbbec3b

File tree

2 files changed

+587
-0
lines changed

2 files changed

+587
-0
lines changed

docs/generators/java.md

Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
---
2+
title: Documentation for the java Generator
3+
---
4+
5+
## METADATA
6+
7+
| Property | Value | Notes |
8+
| -------- | ----- | ----- |
9+
| generator name | java | pass this to the generate command after -g |
10+
| generator stability | STABLE | |
11+
| generator type | CLIENT | |
12+
| generator language | Java | |
13+
| generator default templating engine | mustache | |
14+
| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more. | |
15+
16+
## CONFIG OPTIONS
17+
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
18+
19+
| Option | Description | Values | Default |
20+
| ------ | ----------- | ------ | ------- |
21+
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
22+
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
23+
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
24+
|apiPackage|package for generated api classes| |org.openapitools.client.api|
25+
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
26+
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client|
27+
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
28+
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
29+
|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
30+
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
31+
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
32+
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
33+
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
34+
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
35+
|developerEmail|developer email in generated pom.xml| |[email protected]|
36+
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
37+
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
38+
|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org|
39+
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
40+
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
41+
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
42+
|dynamicOperations|Generate operations dynamically at runtime from an OAS| |false|
43+
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
44+
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
45+
|errorObjectType|Error Object type. (This option is for okhttp-gson-next-gen only)| |null|
46+
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
47+
|gradleProperties|Append additional Gradle properties to the gradle.properties file| |null|
48+
|groupId|groupId in generated pom.xml| |org.openapitools|
49+
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
50+
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
51+
|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
52+
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
53+
|invokerPackage|root package for generated code| |org.openapitools.client|
54+
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
55+
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
56+
|licenseName|The name of the license| |Unlicense|
57+
|licenseUrl|The URL of the license| |http://unlicense.org|
58+
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
59+
|microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null|
60+
|modelPackage|package for generated models| |org.openapitools.client.model|
61+
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
62+
|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
63+
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
64+
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
65+
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
66+
|performBeanValidation|Perform BeanValidation| |false|
67+
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
68+
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
69+
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
70+
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
71+
|serializableModel|boolean - toggle "implements Serializable" for generated models| |false|
72+
|serializationLibrary|Serialization library, default depends on value of the option library|<dl><dt>**jsonb**</dt><dd>Use JSON-B as serialization library</dd><dt>**jackson**</dt><dd>Use Jackson as serialization library</dd><dt>**gson**</dt><dd>Use Gson as serialization library</dd></dl>|null|
73+
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null|
74+
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
75+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
76+
|sourceFolder|source folder for generated code| |src/main/java|
77+
|supportStreaming|Support streaming endpoint (beta)| |false|
78+
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
79+
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
80+
|useBeanValidation|Use BeanValidation API annotations| |false|
81+
|useGzipFeature|Send gzip-encoded requests| |false|
82+
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
83+
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|
84+
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
85+
|useRuntimeException|Use RuntimeException instead of Exception| |false|
86+
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
87+
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
88+
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson support this option.| |false|
89+
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
90+
91+
## SUPPORTED VENDOR EXTENSIONS
92+
93+
| Extension name | Description | Applicable for | Default value |
94+
| -------------- | ----------- | -------------- | ------------- |
95+
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
96+
|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array
97+
|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value
98+
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
99+
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
100+
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
101+
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
102+
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
103+
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false
104+
105+
106+
## IMPORT MAPPING
107+
108+
| Type/Alias | Imports |
109+
| ---------- | ------- |
110+
|Array|java.util.List|
111+
|ArrayList|java.util.ArrayList|
112+
|BigDecimal|java.math.BigDecimal|
113+
|Date|java.util.Date|
114+
|DateTime|org.joda.time.*|
115+
|File|java.io.File|
116+
|HashMap|java.util.HashMap|
117+
|LinkedHashSet|java.util.LinkedHashSet|
118+
|List|java.util.*|
119+
|LocalDate|org.joda.time.*|
120+
|LocalDateTime|org.joda.time.*|
121+
|LocalTime|org.joda.time.*|
122+
|Map|java.util.Map|
123+
|Set|java.util.*|
124+
|Timestamp|java.sql.Timestamp|
125+
|URI|java.net.URI|
126+
|UUID|java.util.UUID|
127+
128+
129+
## INSTANTIATION TYPES
130+
131+
| Type/Alias | Instantiated By |
132+
| ---------- | --------------- |
133+
|array|ArrayList|
134+
|map|HashMap|
135+
|set|LinkedHashSet|
136+
137+
138+
## LANGUAGE PRIMITIVES
139+
140+
<ul class="column-ul">
141+
<li>Boolean</li>
142+
<li>Double</li>
143+
<li>Float</li>
144+
<li>Integer</li>
145+
<li>Long</li>
146+
<li>Object</li>
147+
<li>String</li>
148+
<li>boolean</li>
149+
<li>byte[]</li>
150+
</ul>
151+
152+
## RESERVED WORDS
153+
154+
<ul class="column-ul">
155+
<li>abstract</li>
156+
<li>apiclient</li>
157+
<li>apiexception</li>
158+
<li>apiresponse</li>
159+
<li>assert</li>
160+
<li>boolean</li>
161+
<li>break</li>
162+
<li>byte</li>
163+
<li>case</li>
164+
<li>catch</li>
165+
<li>char</li>
166+
<li>class</li>
167+
<li>configuration</li>
168+
<li>const</li>
169+
<li>continue</li>
170+
<li>default</li>
171+
<li>do</li>
172+
<li>double</li>
173+
<li>else</li>
174+
<li>enum</li>
175+
<li>extends</li>
176+
<li>file</li>
177+
<li>final</li>
178+
<li>finally</li>
179+
<li>float</li>
180+
<li>for</li>
181+
<li>goto</li>
182+
<li>if</li>
183+
<li>implements</li>
184+
<li>import</li>
185+
<li>instanceof</li>
186+
<li>int</li>
187+
<li>interface</li>
188+
<li>list</li>
189+
<li>localreturntype</li>
190+
<li>localvaraccept</li>
191+
<li>localvaraccepts</li>
192+
<li>localvarauthnames</li>
193+
<li>localvarcollectionqueryparams</li>
194+
<li>localvarcontenttype</li>
195+
<li>localvarcontenttypes</li>
196+
<li>localvarcookieparams</li>
197+
<li>localvarformparams</li>
198+
<li>localvarheaderparams</li>
199+
<li>localvarpath</li>
200+
<li>localvarpostbody</li>
201+
<li>localvarqueryparams</li>
202+
<li>long</li>
203+
<li>native</li>
204+
<li>new</li>
205+
<li>null</li>
206+
<li>object</li>
207+
<li>package</li>
208+
<li>private</li>
209+
<li>protected</li>
210+
<li>public</li>
211+
<li>return</li>
212+
<li>short</li>
213+
<li>static</li>
214+
<li>strictfp</li>
215+
<li>stringutil</li>
216+
<li>super</li>
217+
<li>switch</li>
218+
<li>synchronized</li>
219+
<li>this</li>
220+
<li>throw</li>
221+
<li>throws</li>
222+
<li>transient</li>
223+
<li>try</li>
224+
<li>void</li>
225+
<li>volatile</li>
226+
<li>while</li>
227+
</ul>
228+
229+
## FEATURE SET
230+
231+
232+
### Client Modification Feature
233+
| Name | Supported | Defined By |
234+
| ---- | --------- | ---------- |
235+
|BasePath|✓|ToolingExtension
236+
|Authorizations|✗|ToolingExtension
237+
|UserAgent|✗|ToolingExtension
238+
|MockServer|✗|ToolingExtension
239+
240+
### Data Type Feature
241+
| Name | Supported | Defined By |
242+
| ---- | --------- | ---------- |
243+
|Custom|✗|OAS2,OAS3
244+
|Int32|✓|OAS2,OAS3
245+
|Int64|✓|OAS2,OAS3
246+
|Float|✓|OAS2,OAS3
247+
|Double|✓|OAS2,OAS3
248+
|Decimal|✓|ToolingExtension
249+
|String|✓|OAS2,OAS3
250+
|Byte|✓|OAS2,OAS3
251+
|Binary|✓|OAS2,OAS3
252+
|Boolean|✓|OAS2,OAS3
253+
|Date|✓|OAS2,OAS3
254+
|DateTime|✓|OAS2,OAS3
255+
|Password|✓|OAS2,OAS3
256+
|File|✓|OAS2
257+
|Uuid||
258+
|Array|✓|OAS2,OAS3
259+
|Null|✗|OAS3
260+
|AnyType|✗|OAS2,OAS3
261+
|Object|✓|OAS2,OAS3
262+
|Maps|✓|ToolingExtension
263+
|CollectionFormat|✓|OAS2
264+
|CollectionFormatMulti|✓|OAS2
265+
|Enum|✓|OAS2,OAS3
266+
|ArrayOfEnum|✓|ToolingExtension
267+
|ArrayOfModel|✓|ToolingExtension
268+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
269+
|ArrayOfCollectionOfModel|✓|ToolingExtension
270+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
271+
|MapOfEnum|✓|ToolingExtension
272+
|MapOfModel|✓|ToolingExtension
273+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
274+
|MapOfCollectionOfModel|✓|ToolingExtension
275+
|MapOfCollectionOfEnum|✓|ToolingExtension
276+
277+
### Documentation Feature
278+
| Name | Supported | Defined By |
279+
| ---- | --------- | ---------- |
280+
|Readme|✓|ToolingExtension
281+
|Model|✓|ToolingExtension
282+
|Api|✓|ToolingExtension
283+
284+
### Global Feature
285+
| Name | Supported | Defined By |
286+
| ---- | --------- | ---------- |
287+
|Host|✓|OAS2,OAS3
288+
|BasePath|✓|OAS2,OAS3
289+
|Info|✓|OAS2,OAS3
290+
|Schemes|✗|OAS2,OAS3
291+
|PartialSchemes|✓|OAS2,OAS3
292+
|Consumes|✓|OAS2
293+
|Produces|✓|OAS2
294+
|ExternalDocumentation|✓|OAS2,OAS3
295+
|Examples|✓|OAS2,OAS3
296+
|XMLStructureDefinitions|✗|OAS2,OAS3
297+
|MultiServer|✗|OAS3
298+
|ParameterizedServer|✓|OAS3
299+
|ParameterStyling|✗|OAS3
300+
|Callbacks|✗|OAS3
301+
|LinkObjects|✗|OAS3
302+
303+
### Parameter Feature
304+
| Name | Supported | Defined By |
305+
| ---- | --------- | ---------- |
306+
|Path|✓|OAS2,OAS3
307+
|Query|✓|OAS2,OAS3
308+
|Header|✓|OAS2,OAS3
309+
|Body|✓|OAS2
310+
|FormUnencoded|✓|OAS2
311+
|FormMultipart|✓|OAS2
312+
|Cookie|✓|OAS3
313+
314+
### Schema Support Feature
315+
| Name | Supported | Defined By |
316+
| ---- | --------- | ---------- |
317+
|Simple|✓|OAS2,OAS3
318+
|Composite|✓|OAS2,OAS3
319+
|Polymorphism|✗|OAS2,OAS3
320+
|Union|✗|OAS3
321+
|allOf|✗|OAS2,OAS3
322+
|anyOf|✗|OAS3
323+
|oneOf|✗|OAS3
324+
|not|✗|OAS3
325+
326+
### Security Feature
327+
| Name | Supported | Defined By |
328+
| ---- | --------- | ---------- |
329+
|BasicAuth|✗|OAS2,OAS3
330+
|ApiKey|✗|OAS2,OAS3
331+
|OpenIDConnect|✗|OAS3
332+
|BearerToken|✗|OAS3
333+
|OAuth2_Implicit|✗|OAS2,OAS3
334+
|OAuth2_Password|✗|OAS2,OAS3
335+
|OAuth2_ClientCredentials|✗|OAS2,OAS3
336+
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
337+
338+
### Wire Format Feature
339+
| Name | Supported | Defined By |
340+
| ---- | --------- | ---------- |
341+
|JSON|✓|OAS2,OAS3
342+
|XML|✓|OAS2,OAS3
343+
|PROTOBUF|✗|ToolingExtension
344+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)