Skip to content
Permalink
Browse files

Rename generator: csharp-refactor => csharp-netcore (#2348)

* renmae csharp-refactor to csharp-netcore

* update appveyor config

* update config

* update doc
  • Loading branch information...
wing328 committed Mar 12, 2019
1 parent aa7ea8b commit d2ce584a3a902e5921a7aa5db3bc8793932a995f
Showing 373 changed files with 51 additions and 23 deletions.
@@ -24,9 +24,9 @@ install:
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
build_script:
- dotnet --info
# build C# API client (refactor)
- dotnet build samples\client\petstore\csharp-refactor\OpenAPIClient\Org.OpenAPITools.sln
- dotnet build samples\client\petstore\csharp-refactor\OpenAPIClientCore\Org.OpenAPITools.sln
# build C# API client (netcore)
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient\Org.OpenAPITools.sln
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClientCore\Org.OpenAPITools.sln
# build C# API client
- nuget restore samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln
- msbuild samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
@@ -41,9 +41,9 @@ build_script:
test_script:
# restore test-related files
- copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (refactor)
- dotnet test samples\client\petstore\csharp-refactor\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-refactor\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (netcore)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client
- nunit-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
# test c# API client (with PropertyChanged)
@@ -1,7 +1,7 @@
#!/bin/sh

# C# Petstore API client .NET Standard 2.0
./bin/csharp-refactor-petstore.sh
./bin/csharp-netcore-petstore.sh

# C# Petstore API client .NET Core 2.0
./bin/csharp-refactor-petstore-netcore.sh
./bin/csharp-netcore-petstore-netcore.sh
@@ -19,7 +19,7 @@ if [ ! -d "${APP_DIR}" ]; then
fi

executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
outdir="samples/client/petstore/csharp-refactor/OpenAPIClientCore"
outdir="samples/client/petstore/csharp-netcore/OpenAPIClientCore"

if [ ! -f "$executable" ]
then
@@ -28,11 +28,11 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/csharp-refactor/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp-refactor -o ${outdir} --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true,targetFramework=netcoreapp2.0 $@"
ags="generate -t modules/openapi-generator/src/main/resources/csharp-netcore/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp-netcore -o ${outdir} --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true,targetFramework=netcoreapp2.0 $@"

java $JAVA_OPTS -jar $executable $ags

# restore csproj file
echo "restore csproject file: CI/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
cp ./CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/
echo "restore csproject file: CI/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
cp ./CI/samples.ci/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/

@@ -27,11 +27,11 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/csharp-refactor/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp-refactor -o samples/client/petstore/csharp-refactor/OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/csharp-netcore/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp-netcore -o samples/client/petstore/csharp-netcore/OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true $@"

java $JAVA_OPTS -jar $executable $ags

# restore csproj file
echo "restore csproject file: CI/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
cp ./CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/
echo "restore csproject file: CI/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
cp ./CI/samples.ci/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/

@@ -17,7 +17,7 @@ The following generators are available:
- [cpp-tizen](generators/cpp-tizen.md)
- [csharp](generators/csharp.md)
- [csharp-dotnet2](generators/csharp-dotnet2.md)
- [csharp-refactor](generators/csharp-refactor.md)
- [csharp-netcore](generators/csharp-netcore.md)
- [dart](generators/dart.md)
- [dart-jaguar](generators/dart-jaguar.md)
- [eiffel](generators/eiffel.md)
@@ -0,0 +1,29 @@

---
id: generator-opts-client-csharp-netcore
title: Config Options for csharp-netcore
sidebar_label: csharp-netcore
---

| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|packageVersion|C# package version.| |1.0.0|
|sourceFolder|source folder for generated code| |src|
|packageGuid|The GUID that will be associated with the C# project| |null|
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|targetFramework|The target .NET framework version.|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dl>|v4.6.1|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|returnICollection|Return ICollection&lt;T&gt; instead of the concrete type.| |false|
|optionalMethodArgument|C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only).| |true|
|optionalAssemblyInfo|Generate AssemblyInfo.cs.| |true|
|optionalProjectFile|Generate {PackageName}.csproj.| |true|
|optionalEmitDefaultValues|Set DataMember's EmitDefaultValue.| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|validatable|Generates self-validatable models.| |true|
@@ -1,6 +1,5 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +34,7 @@
import static org.openapitools.codegen.utils.StringUtils.underscore;

@SuppressWarnings("Duplicates")
public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen {
public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
// Defines the sdk option for targeted frameworks, which differs from targetFramework and targetFrameworkNuget
protected static final String MCS_NET_VERSION_KEY = "x-mcs-sdk";
protected static final String SUPPORTS_UWP = "supportsUWP";
@@ -79,7 +78,7 @@
// By default, generated code is considered public
protected boolean nonPublicApi = Boolean.FALSE;

public CSharpRefactorClientCodegen() {
public CSharpNetCoreClientCodegen() {
super();

// mapped non-nullable type without ?
@@ -109,7 +108,7 @@ public CSharpRefactorClientCodegen() {
apiTemplateFiles.put("api.mustache", ".cs");
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
embeddedTemplateDir = templateDir = "csharp-refactor";
embeddedTemplateDir = templateDir = "csharp-netcore";

cliOptions.clear();

@@ -286,7 +285,7 @@ public CodegenModel fromModel(String name, Schema model) {

@Override
public String getHelp() {
return "Generates a CSharp client library.";
return "Generates a C# client library (.NET Standard, .NET Core).";
}

// private void syncStringProperty(Map<String, Object> properties, String key)
@@ -308,7 +307,7 @@ public void setModelPropertyNaming(String naming) {

@Override
public String getName() {
return "csharp-refactor";
return "csharp-netcore";
}

public String getNameUsingModelPropertyNaming(String name) {
@@ -15,7 +15,7 @@ org.openapitools.codegen.languages.CppRestbedServerCodegen
org.openapitools.codegen.languages.CppRestSdkClientCodegen
org.openapitools.codegen.languages.CppTizenClientCodegen
org.openapitools.codegen.languages.CSharpClientCodegen
org.openapitools.codegen.languages.CSharpRefactorClientCodegen
org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
org.openapitools.codegen.languages.CSharpNancyFXServerCodegen
org.openapitools.codegen.languages.DartClientCodegen