Skip to content

Commit

Permalink
Remove setting generateAliasAsModel in rust server generator (#2714)
Browse files Browse the repository at this point in the history
* remove setting generateAliasAsModel in rust server

* update rust server samples

* update doc
  • Loading branch information
wing328 authored Apr 22, 2019
1 parent c456300 commit ff55660
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/rust-server-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docs/generators/aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -211,6 +208,10 @@ public RustServerCodegen() {
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)) {
Expand Down

0 comments on commit ff55660

Please sign in to comment.