Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove setting generateAliasAsModel in rust server generator #2714

Merged
merged 3 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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