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

Commit c365430

Browse files
authored
Generators, removes unused config options and libraries (#350)
* Deletes additionalEnumTypeAnnotations * Removes additionalModelTypeAnnotations * Removes asyncNative * Removes bigDecimalAsString * Removes booleanGetterPrefix * Removes caseInsensitiveResponseHeaders * Removes configKey * Removes dateLibrary * Removes disableHtmlEscaping * Removes discriminatorCaseSensitive * Removes dynamicOperations * Removes ensureUniqueParams * Removes enumUnknownDefaultCase * Removes errorObjectType * Removes fullJavaUtil * Removes gradleProperties * Removes ignoreAnyOfInEnum * Removes implicitHeaders * Removes microprofileFramework * Removes microprofileRestClientVersion * Removes openApiNullable * Removes parcelableModel * Removes performBeanValidation * Removes prependFormOrBodyParameters * Removes serializableModel * Docs updated * Removes disallowAdditionalPropertiesIfNotPresent * Removes legacyDiscriminatorBehavior * Fixes java tests * Removes serializationLibrary * Removes sortModelPropertiesByRequiredFlag * Removes sortParamsByRequiredFlag * Removes supportStreaming * Removes useAbstractionForFiles * Removes useBeanValidation * Removes useGzipFeature * Removes useOneOfDiscriminatorLookup * Removes usePlayWS * Removes useReflectionEqualsHashCode * Removes useRuntimeException * Removes useRxJava2 * Removes useRxJava3 * Removes useSingleRequestParameter * Removes withXml * Docs updated * Removes library * Removes modelPackage * Adjusts vendor extensions * Removes unused libraries in java client * Java tests updated of tool * Sample regen * Updates java instantiationTypes * Java instantiation types updated * Removes type-mappings * Removes import-mappings * Removes schemaMappings * Removes inlineSchemaNameMappings * Removes inlineSchemaNameDefaults * Removes reservedWordsMappings * Removes instantiationTypes input * Removes language-specific-primitives input * Removes more inputs * Removes java test * Removes server-variables * Samples regen
1 parent 0b7b360 commit c365430

File tree

55 files changed

+111
-3801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+111
-3801
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,23 +308,18 @@ SYNOPSIS
308308
[--http-user-agent <http user agent>]
309309
[(-i <spec file> | --input-spec <spec file>)]
310310
[--ignore-file-override <ignore file override location>]
311-
[--import-mappings <import mappings>...]
312-
[--instantiation-types <instantiation types>...]
313311
[--invoker-package <invoker package>]
314-
[--language-specific-primitives <language specific primitives>...]
315-
[--legacy-discriminator-behavior] [--library <library>]
316312
[--log-to-stderr] [--minimal-update]
317313
[--model-name-prefix <model name prefix>]
318314
[--model-name-suffix <model name suffix>]
319315
[--model-package <model package>]
320316
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
321317
[--package-name <package name>] [--release-note <release note>]
322318
[--remove-operation-id-prefix]
323-
[--reserved-words-mappings <reserved word mappings>...]
324-
[(-s | --skip-overwrite)] [--server-variables <server variables>...]
319+
[(-s | --skip-overwrite)]
325320
[--skip-validate-spec] [--strict-spec <true/false strict behavior>]
326321
[(-t <template directory> | --template-dir <template directory>)]
327-
[--type-mappings <type mappings>...] [(-v | --verbose)]
322+
[(-v | --verbose)]
328323
329324
OPTIONS
330325
-a <authorization>, --auth <authorization>

bin/new_generator.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ public class ${lang_classname} extends DefaultCodegen implements CodegenConfig {
180180
apiTemplateFiles.put("api.mustache", ".zz");
181181
embeddedTemplateDir = templateDir = "${gen_name_camel}";
182182
apiPackage = "Apis";
183-
modelPackage = "Models";
184183
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
185184
// TODO: Fill this out.
186185
}

docs/3.0.0-release-note.md

Lines changed: 0 additions & 362 deletions
This file was deleted.

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ For other languages, feel free to suggest.
8282
You may find the current code base not 100% conform to the coding style and we welcome contributions to fix those.
8383

8484
For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#vendorExtensions), please follow the naming convention below:
85-
- For general vendor extension, use lower case and hyphen. e.g. `x-is-unique`, `x-content-type`
85+
- For general vendor extension, use lower case and hyphen. e.g. `x-is-unique`,
8686
- For language-specified vendor extension, put it in the form of `x-{lang}-{extension-name}`. e.g. `x-objc-operation-id`, `x-java-feign-retry-limit`
8787
- For a list of existing vendor extensions in use, please refer to https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/wiki/Vendor-Extensions. If you've added new vendor extensions as part of your PR, please update the wiki page.
8888

docs/customization.md

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ You might have an external configuration file named `config.yaml` which defines
1616
```yaml
1717
additionalProperties:
1818
artifactId: kotlin-petstore-client
19-
serializableModel: "true"
20-
dateLibrary: java8
2119
```
2220
2321
You would generate via CLI with the command:
@@ -32,8 +30,6 @@ To support the above scenario with custom templates, ensure that you're pointing
3230
templateDir: my_custom_templates
3331
additionalProperties:
3432
artifactId: kotlin-petstore-client
35-
serializableModel: "true"
36-
dateLibrary: java8
3733
files:
3834
AUTHORS.md: {}
3935
api_interfaces.mustache:
@@ -310,22 +306,9 @@ Output
310306

311307
```
312308
CONFIG OPTIONS
313-
modelPackage
314-
package for generated models
315-
316309
apiPackage
317310
package for generated api classes
318311
...... (results omitted)
319-
library
320-
library template (sub-template) to use:
321-
jersey1 - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2
322-
jersey2 - HTTP client: Jersey client 2.6
323-
feign - HTTP client: Netflix Feign 8.1.1. JSON processing: Jackson 2.6.3
324-
okhttp-gson (default) - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1
325-
retrofit - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1 (Retrofit 1.9.0)
326-
retrofit2 - HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.0-beta2)
327-
google-api-client - HTTP client: google-api-client 1.23.0. JSON processing: Jackson 2.8.9
328-
rest-assured - HTTP client: rest-assured : 4.3.0. JSON processing: Gson 2.8.6. Only for Java8
329312
```
330313
331314
Your config file for Java can look like
@@ -334,8 +317,7 @@ Your config file for Java can look like
334317
{
335318
"groupId":"com.my.company",
336319
"artifactId":"MyClient",
337-
"artifactVersion":"1.2.0",
338-
"library":"feign"
320+
"artifactVersion":"1.2.0"
339321
}
340322
```
341323

@@ -371,72 +353,6 @@ and specify the `classname` when running the generator:
371353

372354
Your subclass will now be loaded and overrides the `PREFIX` value in the superclass.
373355

374-
## Bringing your own models
375-
376-
Sometimes you don't want a model generated. In this case, you can simply specify an import mapping to tell
377-
the codegen what _not_ to create. When doing this, every location that references a specific model will
378-
refer back to your classes. Note, this may not apply to all languages...
379-
380-
To specify an import mapping, use the `--import-mappings` argument and specify the model-to-import logic as such:
381-
382-
```
383-
--import-mappings Pet=my.models.MyPet
384-
```
385-
386-
Or for multiple mappings:
387-
388-
```
389-
--import-mappings Pet=my.models.MyPet,Order=my.models.MyOrder
390-
```
391-
or
392-
```
393-
--import-mappings Pet=my.models.MyPet --import-mappings Order=my.models.MyOrder
394-
```
395-
396-
## Schema Mapping
397-
398-
One can map the schema to someting else (e.g. external objects/models outside of the package) using the `schemaMappings` option, e.g. in CLI
399-
```sh
400-
java -jar target/openapi-generator-cli.jar generate -g java -i src/test/resources/3_0/type-alias.yaml -o /tmp/java2/ --schema-mapping TypeAlias=foo.bar.TypeAlias
401-
```
402-
Another example (in conjunction with --type-mappings):
403-
```sh
404-
java -jar target/openapi-generator-cli.jar generate -g java -i /tmp/alias.yaml -o /tmp/alias/ --schema-mappings stream=org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody --type-mappings string+binary=stream
405-
```
406-
while /tmp/alias.yaml is as follows:
407-
```yaml
408-
openapi: 3.0.3
409-
info:
410-
title: Demo app
411-
version: 1.0.0
412-
servers:
413-
- url: /api/v1
414-
paths:
415-
/demo:
416-
get:
417-
summary: Demo
418-
operationId: demo
419-
responses:
420-
'200':
421-
description: Demo response
422-
content:
423-
text/csv:
424-
schema:
425-
type: string
426-
format: binary
427-
```
428-
429356
## Inline Schema Naming
430357

431-
Inline schemas are created as separate schemas automatically and the auto-generated schema name may not look good to everyone. One can customize the name using the `title` field or the `inlineSchemaNameMapping` option, e.g. in CLI
432-
433-
```
434-
java -jar target/openapi-generator-cli.jar generate -g java -i src/test/resources/3_0/inline_model_resolver.yaml -o /tmp/java3/ --skip-validate-spec --inline-schema-name-mappings inline_object_2=SomethingMapped,inline_object_4=nothing_new
435-
```
436-
437-
Another useful option is `inlineSchemaNameDefaults`, which allows you to customize the suffix of the auto-generated inline schema name, e.g. in CLI
438-
```
439-
--inline-schema-name-defaults arrayItemSuffix=_array_item
440-
```
441-
442-
Note: Only arrayItemSuffix, mapItemSuffix are supported at the moment.
358+
Inline schemas are created as separate schemas automatically and the auto-generated schema name may not look good to everyone. One can customize the name using the `title` field

docs/faq-generators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ config.templateDir = 'src/openapi-generator-templates/Java/libraries/feign
4040
mvn clean package
4141
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
4242
-i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/src/test/resources/3_0/petstore.json \
43-
-l java --library=okhttp-gson \
43+
-l java \
4444
--additional-properties hideGenerationTimestamp=true \
4545
-o /var/tmp/java/okhttp-gson/
4646
```
@@ -56,7 +56,7 @@ To generate the Android SDK with [`volley`](https://github.com/mcxiaoke/android-
5656
mvn clean package
5757
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
5858
-i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/src/test/resources/3_0/petstore.json \
59-
-l android --library=volley \
59+
-l android \
6060
-o /var/tmp/android/volley/
6161
```
6262
We do **not** recommend using the default HTTP library (Apache HttpClient) with `android` as it's not actively maintained.

0 commit comments

Comments
 (0)