Skip to content

Commit c5ac7d4

Browse files
authored
Various enhancements, bug fixes to default codegen and maven plugin (#20388)
* fix typos in docs * minor fix in default codegen * fix more typos
1 parent 8fa8530 commit c5ac7d4

File tree

15 files changed

+31
-31
lines changed

15 files changed

+31
-31
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0, 3.1 (beta support)
142142

143143
For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page.
144144

145-
For decomissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page.
145+
For decommissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page.
146146

147147
## [1.2 - Artifacts on Maven Central](#table-of-contents)
148148

docs/3.0.0-release-note.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sidebar_label: "Release Notes: 3.0.0"
1010
* e58dc2c77 Fix COPY in Dockerfile (#64)
1111
* 9d7feaaeb Fix online generator (docker push) (#58)
1212
* 9247cd01e Changes for Docker
13-
* 64037ee59 update docker-related files to ues jdk8
13+
* 64037ee59 update docker-related files to use jdk8
1414

1515
* ## Plug-ins
1616
* b6b8c0db8 \[gradle-plugin] Initial implementation (#162)

docs/customization.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ Upon first code generation, you may also pass the CLI option `--ignore-file-over
266266

267267
Editor support for `.openapi-generator-ignore` files is available in IntelliJ via the [.ignore plugin](https://plugins.jetbrains.com/plugin/7495--ignore).
268268

269-
One may want to pre-populate `.openapi-generator-ignore` with a list of entries during the code generation process and the global/general option `openapiGeneatorIgnoreList` (e.g. --openapi-generator-ignore-list in CLI) can do exactly that. For example,
269+
One may want to pre-populate `.openapi-generator-ignore` with a list of entries during the code generation process and the global/general option `openapiGeneratorIgnoreList` (e.g. --openapi-generator-ignore-list in CLI) can do exactly that. For example,
270270
```
271271
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g spring -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/spring --additional-properties useTags=true --openapi-generator-ignore-list "README.md,pom.xml,docs/*.md,src/main/java/org/openapitools/model/*"
272272
```
@@ -434,9 +434,9 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
434434
```
435435
will rename SOLD to UNAVAILABLE instead.
436436

437-
Not all generators support thess features yet. Please give it a try to confirm the behaviour and open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly. We also welcome PRs to add these features to generators. Related PRs for reference: #16209, #16234 (modelNameMappings), #16194, #16206 (nameMappings, parameterNameMappings), #17108 (enumNameMappings).
437+
Not all generators support these features yet. Please give it a try to confirm the behaviour and open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly. We also welcome PRs to add these features to generators. Related PRs for reference: #16209, #16234 (modelNameMappings), #16194, #16206 (nameMappings, parameterNameMappings), #17108 (enumNameMappings).
438438

439-
NOTE: some generators use `baseName` (original name obtained direclty from OpenAPI spec, e.g. `shipping-date`) mustache tag in the templates so the mapping feature won't work.
439+
NOTE: some generators use `baseName` (original name obtained directly from OpenAPI spec, e.g. `shipping-date`) mustache tag in the templates so the mapping feature won't work.
440440

441441
To map `operationId` (used in method naming) to something else, use `operationIdNameMappings` option, e.g.
442442

@@ -480,7 +480,7 @@ paths:
480480
481481
## Inline Schema Naming
482482
483-
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. For exmaple, run the following,
483+
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. For example, run the following,
484484

485485
```
486486
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/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
@@ -503,7 +503,7 @@ Another useful option is `inlineSchemaOptions`, which allows you to customize ho
503503
- `ARRAY_ITEM_SUFFIX` sets the array item suffix
504504
- `MAP_ITEM_SUFFIX` set the map item suffix
505505
- `SKIP_SCHEMA_REUSE=true` is a special value to skip reusing inline schemas during refactoring
506-
- `REFACTOR_ALLOF_INLINE_SCHEMAS=true` will restore the 6.x (or below) behaviour to refactor allOf inline schemas into $ref. (v7.0.0 will skip the refactoring of these allOf inline schmeas by default)
506+
- `REFACTOR_ALLOF_INLINE_SCHEMAS=true` will restore the 6.x (or below) behaviour to refactor allOf inline schemas into $ref. (v7.0.0 will skip the refactoring of these allOf inline schemas by default)
507507
- `RESOLVE_INLINE_ENUMS=true` will refactor inline enum definitions into $ref
508508
509509
## OpenAPI Normalizer
@@ -524,7 +524,7 @@ Example:
524524
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --openapi-normalizer REF_AS_PARENT_IN_ALLOF=true
525525
```
526526
527-
- `REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY`: when set to `true`, oneOf/anyOf schema with only required properies only in a schema with properties will be removed. [(example)](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml)
527+
- `REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY`: when set to `true`, oneOf/anyOf schema with only required properties only in a schema with properties will be removed. [(example)](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml)
528528
529529
Example:
530530
```

modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ public void execute() throws MojoExecutionException {
865865
}
866866

867867
// Apply Parameter Name Mappings
868-
if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("paramter-name-mappings"))) {
868+
if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("parameter-name-mappings"))) {
869869
applyParameterNameMappingsKvpList(parameterNameMappings, configurator);
870870
}
871871

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1942,9 +1942,9 @@ public String toInstantiationType(Schema schema) {
19421942
if (ModelUtils.isMapSchema(schema)) {
19431943
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
19441944
String inner = getSchemaType(additionalProperties);
1945-
String mapInstantion = instantiationTypes.get("map");
1946-
if (mapInstantion != null) {
1947-
return mapInstantion + "<String, " + inner + ">";
1945+
String mapInstantiation = instantiationTypes.get("map");
1946+
if (mapInstantiation != null) {
1947+
return mapInstantiation + "<String, " + inner + ">";
19481948
}
19491949
return inner;
19501950
} else if (ModelUtils.isArraySchema(schema)) {
@@ -2217,7 +2217,7 @@ public String toDefaultValueWithParam(String name, Schema schema) {
22172217
* @return string presentation of the default value of the property
22182218
*/
22192219
public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
2220-
// use toDefaultValue(schema) if generator has not overriden this method
2220+
// use toDefaultValue(schema) if generator has not overridden this method
22212221
return toDefaultValue(schema);
22222222
}
22232223

@@ -3149,7 +3149,7 @@ protected void setAddProps(Schema schema, IJsonSchemaValidationProperties proper
31493149
// if we are trying to set additionalProperties on an empty schema stop recursing
31503150
return;
31513151
}
3152-
// Note: This flag is set to true if additioanl properties
3152+
// Note: This flag is set to true if additional properties
31533153
// is set (any type, free form object, boolean true, string, etc).
31543154
// The variable name may be renamed later to avoid confusion.
31553155
boolean additionalPropertiesIsAnyType = false;
@@ -3989,7 +3989,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo
39893989
property._enum = new ArrayList<>();
39903990
for (Object i : _enum) {
39913991
// raw null values in enums are unions for nullable
3992-
// atttributes, not actual enum values, so we remove them here
3992+
// attributes, not actual enum values, so we remove them here
39933993
if (i == null) {
39943994
property.isNullable = true;
39953995
continue;
@@ -4001,7 +4001,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo
40014001

40024002
Map<String, Object> allowableValues = new HashMap<>();
40034003
allowableValues.put("values", _enum);
4004-
if (allowableValues.size() > 0) {
4004+
if (!allowableValues.isEmpty()) {
40054005
property.allowableValues = allowableValues;
40064006
}
40074007
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ private Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visited
836836
}
837837

838838
// ===================== a list of rules =====================
839-
// all rules (fuctions) start with the word "process"
839+
// all rules (functions ) start with the word "process"
840840

841841
/**
842842
* Child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema).

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ private boolean startsWithTwoUppercaseLetters(String name) {
936936

937937
@Override
938938
public String toParamName(String name) {
939-
// obtain the name from paramterNameMapping directly if provided
939+
// obtain the name from parameterNameMapping directly if provided
940940
if (parameterNameMapping.containsKey(name)) {
941941
return parameterNameMapping.get(name);
942942
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJuliaCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected static String dropDots(String str) {
173173

174174
/**
175175
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
176-
* those terms here. This logic is only called if a variable matches the reseved words
176+
* those terms here. This logic is only called if a variable matches the reserved words
177177
*
178178
* @return the escaped term
179179
*/

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ private String getModelNameFromDataType(CodegenProperty cp) {
11851185
}
11861186

11871187
/**
1188-
* Update set of imports from codegen model recursivly
1188+
* Update set of imports from codegen model recursively
11891189
*
11901190
* @param modelName model name
11911191
* @param cm codegen model
@@ -1362,7 +1362,7 @@ public void postProcessPattern(String pattern, Map<String, Object> vendorExtensi
13621362
if (pattern != null) {
13631363
int i = pattern.lastIndexOf('/');
13641364

1365-
// TOOD update the check below follow python convention
1365+
// TODO update the check below follow python convention
13661366
//Must follow Perl /pattern/modifiers convention
13671367
if (pattern.charAt(0) != '/' || i < 2) {
13681368
throw new IllegalArgumentException("Pattern must follow the Perl "

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ private String getModelNameFromDataType(CodegenProperty cp) {
16871687
}
16881688

16891689
/**
1690-
* Update set of imports from codegen model recursivly
1690+
* Update set of imports from codegen model recursively
16911691
*
16921692
* @param modelName model name
16931693
* @param cm codegen model
@@ -1896,7 +1896,7 @@ public void postProcessPattern(String pattern, Map<String, Object> vendorExtensi
18961896
if (pattern != null) {
18971897
int i = pattern.lastIndexOf('/');
18981898

1899-
// TOOD update the check below follow python convention
1899+
// TODO update the check below follow python convention
19001900
//Must follow Perl /pattern/modifiers convention
19011901
if (pattern.charAt(0) != '/' || i < 2) {
19021902
throw new IllegalArgumentException("Pattern must follow the Perl "

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public String apiFileFolder() {
335335
}
336336

337337
/**
338-
* Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli
338+
* Location of created model files (it can be overridden using --additional-properties in openapi-generator-cli
339339
*/
340340
@Override
341341
public String modelFileFolder() {

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public void processOpts() {
320320
dateLibrary = "legacy";
321321
}
322322
super.processOpts();
323-
// default jackson unless overriden by setSerializationLibrary
323+
// default jackson unless overridden by setSerializationLibrary
324324
this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) || SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
325325

326326
convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup);

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ private void processJVMOkHttpLibrary(final String infrastructureFolder) {
793793
supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt"));
794794
}
795795

796-
private void proccessJvmSpring(final String infrastructureFolder) {
796+
private void processJvmSpring(final String infrastructureFolder) {
797797
if (getSerializationLibrary() != SERIALIZATION_LIBRARY_TYPE.jackson) {
798798
throw new RuntimeException("This library currently only supports jackson serialization. Try adding '--additional-properties serializationLibrary=jackson' to your command.");
799799
}
@@ -806,7 +806,7 @@ private void proccessJvmSpring(final String infrastructureFolder) {
806806
}
807807

808808
private void processJvmSpringWebClientLibrary(final String infrastructureFolder) {
809-
proccessJvmSpring(infrastructureFolder);
809+
processJvmSpring(infrastructureFolder);
810810
additionalProperties.put(JVM_SPRING_WEBCLIENT, true);
811811
}
812812

@@ -815,7 +815,7 @@ private void processJvmSpringRestClientLibrary(final String infrastructureFolder
815815
throw new RuntimeException("This library must use Spring Boot 3. Try adding '--additional-properties useSpringBoot3=true' to your command.");
816816
}
817817

818-
proccessJvmSpring(infrastructureFolder);
818+
processJvmSpring(infrastructureFolder);
819819
additionalProperties.put(JVM_SPRING_RESTCLIENT, true);
820820
}
821821

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ public CodegenModel fromModel(String name, Schema model) {
12261226
}
12271227
}
12281228

1229-
// Do we suppport doing ToString/FromStr conversions for query parameters?
1229+
// Do we support doing ToString/FromStr conversions for query parameters?
12301230
boolean toStringSupport = true;
12311231
boolean isString = "String".equals(mdl.dataType);
12321232

modules/openapi-generator/src/test/resources/3_0/jetbrains/github.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -94117,7 +94117,7 @@
9411794117
"nullable": true
9411894118
},
9411994119
"idle_timeout_notice": {
94120-
"description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy",
94120+
"description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy",
9412194121
"type": "string",
9412294122
"nullable": true
9412394123
},
@@ -116606,7 +116606,7 @@
116606116606
"nullable": true
116607116607
},
116608116608
"idle_timeout_notice": {
116609-
"description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy",
116609+
"description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy",
116610116610
"type": "string",
116611116611
"nullable": true
116612116612
},

0 commit comments

Comments
 (0)