openapi-generator/bin/csharp-petstore.sh
Jim Schubert 2c9f98ce38 [csharp] clean boolean additional properties 6784 (#6899)
* [csharp] Convert "false" properties to booleans

It appears as though "false" strings in additionalProperties are no
longer treated as false booleans. This may be an issue elsewhere, but a
simple fix is to always explicitly set the boolean value in a generator
class back to the additionalProperties map to convert boolean Strings to
boolean Objects.

* [nancyfx] Clean up async default option handling

* [nancyfx] Include asyncServer=false in sample script

* [csharp] Regenerate samples

* [csharp] Resolve .net 4 generation issues

Some functionality is missing from .NET 4.0, such as IReadonlyDictionary
and Type.GetTypeInfo().

This commit resolves compilation of generated .NET 4.0 code, requiring
no conditional versioning of Newtonsoft.Json.

* [csharp] Regenerate .net 4.0 sample

* [csharp] Resolve .NET 4.0 sample compile

Sample build.sh wasn't accounting for targeting different FCL correctly.
That is, when passing "net40" to the -sdk option, it would use the
default -sdk:4 and -langversion:6. These don't necessarily match with
what is installed on a machine with only .NET 4.0 (which is our targeted
use case here).

To resolve, we need to define another version-specific value for passing
to the mcs -sdk option (see man mcs for details).

This option currently isn't overridable in the client codegen class.
Also, langversion is set specifically to the version of C# available to
the targeted SDK version. If there is need, we may extend this to
something like:

langversion=${MCS_LANG_VERSION:-6}

To allow users to run as:

   env MCS_LANG_VERSION=5 sh build.sh

I haven't done this because I doubt there's much of a use case via this
script. I'm assuming most consumers will build via IDE or MSBuild.

* [csharp] Revert bin/csharp-petstore.sh to 3.5

* [csharp] Regenerate .NET 3.5 sample

* [csharp] Resolve nuget issue with existing files

* [csharp] Update -all.sh, regenerate samples
2017-11-15 22:36:37 +08:00

32 lines
926 B
Bash
Executable File

#!/bin/sh
SCRIPT="$0"
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/swagger-codegen-cli/target/swagger-codegen-cli.jar"
if [ ! -f "$executable" ]
then
mvn 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 $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
java $JAVA_OPTS -jar $executable $ags