Various enhancements, bug fixes to default codegen and maven plugin (#20388)

* fix typos in docs

* minor fix in default codegen

* fix more typos
This commit is contained in:
William Cheng 2024-12-30 16:42:26 +08:00 committed by GitHub
parent 8fa8530cd0
commit c5ac7d485f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 31 additions and 31 deletions

View File

@ -142,7 +142,7 @@ OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0, 3.1 (beta support)
For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page.
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.
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.
## [1.2 - Artifacts on Maven Central](#table-of-contents)

View File

@ -10,7 +10,7 @@ sidebar_label: "Release Notes: 3.0.0"
* e58dc2c77 Fix COPY in Dockerfile (#64)
* 9d7feaaeb Fix online generator (docker push) (#58)
* 9247cd01e Changes for Docker
* 64037ee59 update docker-related files to ues jdk8
* 64037ee59 update docker-related files to use jdk8
* ## Plug-ins
* b6b8c0db8 \[gradle-plugin] Initial implementation (#162)

View File

@ -266,7 +266,7 @@ Upon first code generation, you may also pass the CLI option `--ignore-file-over
Editor support for `.openapi-generator-ignore` files is available in IntelliJ via the [.ignore plugin](https://plugins.jetbrains.com/plugin/7495--ignore).
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,
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,
```
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/*"
```
@ -434,9 +434,9 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
```
will rename SOLD to UNAVAILABLE instead.
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).
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).
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.
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.
To map `operationId` (used in method naming) to something else, use `operationIdNameMappings` option, e.g.
@ -480,7 +480,7 @@ paths:
## Inline Schema Naming
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,
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,
```
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
- `ARRAY_ITEM_SUFFIX` sets the array item suffix
- `MAP_ITEM_SUFFIX` set the map item suffix
- `SKIP_SCHEMA_REUSE=true` is a special value to skip reusing inline schemas during refactoring
- `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)
- `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)
- `RESOLVE_INLINE_ENUMS=true` will refactor inline enum definitions into $ref
## OpenAPI Normalizer
@ -524,7 +524,7 @@ Example:
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
```
- `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)
- `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)
Example:
```

View File

@ -865,7 +865,7 @@ public class CodeGenMojo extends AbstractMojo {
}
// Apply Parameter Name Mappings
if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("paramter-name-mappings"))) {
if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("parameter-name-mappings"))) {
applyParameterNameMappingsKvpList(parameterNameMappings, configurator);
}

View File

@ -1942,9 +1942,9 @@ public class DefaultCodegen implements CodegenConfig {
if (ModelUtils.isMapSchema(schema)) {
Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
String inner = getSchemaType(additionalProperties);
String mapInstantion = instantiationTypes.get("map");
if (mapInstantion != null) {
return mapInstantion + "<String, " + inner + ">";
String mapInstantiation = instantiationTypes.get("map");
if (mapInstantiation != null) {
return mapInstantiation + "<String, " + inner + ">";
}
return inner;
} else if (ModelUtils.isArraySchema(schema)) {
@ -2217,7 +2217,7 @@ public class DefaultCodegen implements CodegenConfig {
* @return string presentation of the default value of the property
*/
public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
// use toDefaultValue(schema) if generator has not overriden this method
// use toDefaultValue(schema) if generator has not overridden this method
return toDefaultValue(schema);
}
@ -3149,7 +3149,7 @@ public class DefaultCodegen implements CodegenConfig {
// if we are trying to set additionalProperties on an empty schema stop recursing
return;
}
// Note: This flag is set to true if additioanl properties
// Note: This flag is set to true if additional properties
// is set (any type, free form object, boolean true, string, etc).
// The variable name may be renamed later to avoid confusion.
boolean additionalPropertiesIsAnyType = false;
@ -3989,7 +3989,7 @@ public class DefaultCodegen implements CodegenConfig {
property._enum = new ArrayList<>();
for (Object i : _enum) {
// raw null values in enums are unions for nullable
// atttributes, not actual enum values, so we remove them here
// attributes, not actual enum values, so we remove them here
if (i == null) {
property.isNullable = true;
continue;
@ -4001,7 +4001,7 @@ public class DefaultCodegen implements CodegenConfig {
Map<String, Object> allowableValues = new HashMap<>();
allowableValues.put("values", _enum);
if (allowableValues.size() > 0) {
if (!allowableValues.isEmpty()) {
property.allowableValues = allowableValues;
}
}

View File

@ -836,7 +836,7 @@ public class OpenAPINormalizer {
}
// ===================== a list of rules =====================
// all rules (fuctions) start with the word "process"
// all rules (functions ) start with the word "process"
/**
* Child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema).

View File

@ -936,7 +936,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
@Override
public String toParamName(String name) {
// obtain the name from paramterNameMapping directly if provided
// obtain the name from parameterNameMapping directly if provided
if (parameterNameMapping.containsKey(name)) {
return parameterNameMapping.get(name);
}

View File

@ -173,7 +173,7 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
/**
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
* those terms here. This logic is only called if a variable matches the reseved words
* those terms here. This logic is only called if a variable matches the reserved words
*
* @return the escaped term
*/

View File

@ -1185,7 +1185,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
}
/**
* Update set of imports from codegen model recursivly
* Update set of imports from codegen model recursively
*
* @param modelName model name
* @param cm codegen model
@ -1362,7 +1362,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
if (pattern != null) {
int i = pattern.lastIndexOf('/');
// TOOD update the check below follow python convention
// TODO update the check below follow python convention
//Must follow Perl /pattern/modifiers convention
if (pattern.charAt(0) != '/' || i < 2) {
throw new IllegalArgumentException("Pattern must follow the Perl "

View File

@ -1687,7 +1687,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
}
/**
* Update set of imports from codegen model recursivly
* Update set of imports from codegen model recursively
*
* @param modelName model name
* @param cm codegen model
@ -1896,7 +1896,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
if (pattern != null) {
int i = pattern.lastIndexOf('/');
// TOOD update the check below follow python convention
// TODO update the check below follow python convention
//Must follow Perl /pattern/modifiers convention
if (pattern.charAt(0) != '/' || i < 2) {
throw new IllegalArgumentException("Pattern must follow the Perl "

View File

@ -335,7 +335,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
}
/**
* Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli
* Location of created model files (it can be overridden using --additional-properties in openapi-generator-cli
*/
@Override
public String modelFileFolder() {

View File

@ -320,7 +320,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
dateLibrary = "legacy";
}
super.processOpts();
// default jackson unless overriden by setSerializationLibrary
// default jackson unless overridden by setSerializationLibrary
this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) || SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup);

View File

@ -793,7 +793,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt"));
}
private void proccessJvmSpring(final String infrastructureFolder) {
private void processJvmSpring(final String infrastructureFolder) {
if (getSerializationLibrary() != SERIALIZATION_LIBRARY_TYPE.jackson) {
throw new RuntimeException("This library currently only supports jackson serialization. Try adding '--additional-properties serializationLibrary=jackson' to your command.");
}
@ -806,7 +806,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
private void processJvmSpringWebClientLibrary(final String infrastructureFolder) {
proccessJvmSpring(infrastructureFolder);
processJvmSpring(infrastructureFolder);
additionalProperties.put(JVM_SPRING_WEBCLIENT, true);
}
@ -815,7 +815,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
throw new RuntimeException("This library must use Spring Boot 3. Try adding '--additional-properties useSpringBoot3=true' to your command.");
}
proccessJvmSpring(infrastructureFolder);
processJvmSpring(infrastructureFolder);
additionalProperties.put(JVM_SPRING_RESTCLIENT, true);
}

View File

@ -1226,7 +1226,7 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
}
}
// Do we suppport doing ToString/FromStr conversions for query parameters?
// Do we support doing ToString/FromStr conversions for query parameters?
boolean toStringSupport = true;
boolean isString = "String".equals(mdl.dataType);

View File

@ -94117,7 +94117,7 @@
"nullable": true
},
"idle_timeout_notice": {
"description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy",
"description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy",
"type": "string",
"nullable": true
},
@ -116606,7 +116606,7 @@
"nullable": true
},
"idle_timeout_notice": {
"description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy",
"description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy",
"type": "string",
"nullable": true
},