-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C# refactor improvements: .NET Standard and .NET Core (#2187)
* [csharp-refactor] limit available target framework This removes .NET 3.x, .NET 4.0, UWP, and the "5.0" option (which referred to PCL 5.0). This gives us a smaller footprint for maintenance, and doesn't necessarily block consumers from creating custom templates to support those target frameworks. A workaround for users wanting these options is to build against openapi-generator 3.3.4. This moves logic for applying additional properties to strategies per target framework, as a means to reduce maintenance overhead at the cost of maybe a little redundancy between strategies. * [csharp-refactor] Fixing .netstandard support * [csharp-refactor] Fixing netcoreapp2.0 support * [csharp-refactor] Regenerate samples * Fix toLowerCase missing Local.ROOT * [csharp-refactor] Remove unnecessary bash/batch scripts, update appveyor. * Update appveyor.yml to test for dotnet/xunit * Update appveyor.yml Wrap xunit console environment variables in quotes, to prevent yaml syntax error. * Update appveyor.yml Try to use dos-style switches, attempting to remove yaml parse error in appveyor. Previous command matched appveyor docs, but resulted in the parser error. * Update appveyor.yml Wrap full commands for netstandard tests in quotes * Fix linux style slashes in dotnet build, use dotnet test over appveyor xunit * [csharp-refactor] Update generator docs
- Loading branch information
1 parent
cdb447d
commit f39e200
Showing
248 changed files
with
25,352 additions
and
2,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
.../csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
OpenAPI Petstore | ||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
OpenAPI spec version: 1.0.0 | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj"> | ||
<Name>Org.OpenAPITools</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="linux-logo.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="CompareNETObjects" Version="4.57.0" /> | ||
<PackageReference Include="JsonSubTypes" Version="1.5.2" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" /> | ||
<PackageReference Include="RestSharp" Version="106.6.7" /> | ||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# C# Petstore API client (.NET 3.5) | ||
# C# Petstore API client .NET Standard 2.0 | ||
./bin/csharp-refactor-petstore.sh | ||
|
||
# C# Petstore API client with PropertyChanged | ||
./bin/csharp-refactor-property-changed-petstore.sh | ||
|
||
# C# Petstore API client (v5.0 for .net standarnd 1.3+) | ||
./bin/csharp-refactor-petstore-net-standard.sh | ||
|
||
# C# Petstore API client (.NET 4.0) | ||
./bin/csharp-refactor-petstore-net-40.sh | ||
|
||
# C# Petstore API client (.NET 3.5) | ||
./bin/csharp-refactor-petstore-net-35.sh | ||
|
||
# C# Petstore API client .NET Core 2.0 | ||
./bin/csharp-refactor-petstore-netcore.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
SCRIPT="$0" | ||
echo "# START SCRIPT: $SCRIPT" | ||
|
||
while [ -h "$SCRIPT" ] ; do | ||
ls=`ls -ld "$SCRIPT"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
SCRIPT="$link" | ||
else | ||
SCRIPT=`dirname "$SCRIPT"`/"$link" | ||
fi | ||
done | ||
|
||
if [ ! -d "${APP_DIR}" ]; then | ||
APP_DIR=`dirname "$SCRIPT"`/.. | ||
APP_DIR=`cd "${APP_DIR}"; pwd` | ||
fi | ||
|
||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" | ||
outdir="samples/client/petstore/csharp-refactor/OpenAPIClientCore" | ||
|
||
if [ ! -f "$executable" ] | ||
then | ||
mvn -B clean package | ||
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 $@" | ||
|
||
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/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.