forked from loafle/openapi-generator-original
Remove setting generateAliasAsModel in rust server generator (#2714)
* remove setting generateAliasAsModel in rust server * update rust server samples * update doc
This commit is contained in:
@@ -34,6 +34,7 @@ for spec_path in modules/openapi-generator/src/test/resources/*/rust-server/* ;
|
||||
--output samples/server/petstore/rust-server/output/$spec
|
||||
-DpackageName=$spec
|
||||
--additional-properties hideGenerationTimestamp=true
|
||||
--generate-alias-as-model
|
||||
$@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
|
||||
@@ -23,7 +23,11 @@ sidebar_label: aspnetcore
|
||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||
|useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |true|
|
||||
|isLibrary|Is the build a library| |false|
|
||||
|classModifier|Class Modifier can be empty, abstract| ||
|
||||
|operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual|
|
||||
|buildTarget|Target to build an application or library| |program|
|
||||
|generateBody|Generates method body.| |true|
|
||||
|operationIsAsync|Set methods to async or sync.| |false|
|
||||
|operationResultTask|Set methods result to Task<>.| |false|
|
||||
|modelClassModifier|Model Class Modifier can be nothing or partial| |partial|
|
||||
|
||||
@@ -67,9 +67,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public RustServerCodegen() {
|
||||
super();
|
||||
|
||||
// Force generating models for wrapping types
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
|
||||
// Show the generation timestamp by default
|
||||
hideGenerationTimestamp = Boolean.FALSE;
|
||||
|
||||
@@ -211,6 +208,10 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (!Boolean.TRUE.equals(ModelUtils.isGenerateAliasAsModel())) {
|
||||
LOGGER.warn("generateAliasAsModel is set to false, which means array/map will be generated as model instead and the resulting code may have issues. Please enable `generateAliasAsModel` to address the issue.");
|
||||
}
|
||||
|
||||
setPackageName((String) additionalProperties.getOrDefault(CodegenConstants.PACKAGE_NAME, "openapi_client"));
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
|
||||
|
||||
Reference in New Issue
Block a user