Skip to content

Commit

Permalink
[csharp] Update nuget.exe URL for latest version (#6031)
Browse files Browse the repository at this point in the history
* Set nuget.exe URL to latest version

Fix #6022

* Update samples
  • Loading branch information
beatcracker authored and wing328 committed Jul 13, 2017
1 parent 4f33a02 commit ef076c3
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"

echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install src/{{packageName}}/packages.config -o packages;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5
{{/supportsAsync}}

if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\{{packageName}}\packages.config -o packages

if not exist ".\bin" mkdir bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#

wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync

echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null

echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.3-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Example
{
public void main()
{

var apiInstance = new FakeApi();
var testCodeInjectEndRnNR = testCodeInjectEndRnNR_example; // string | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)
Expand All @@ -80,6 +80,7 @@ namespace Example
{
Debug.Print("Exception when calling FakeApi.TestCodeInjectEndRnNR: " + e.Message );
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319

if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\IO.Swagger\packages.config -o packages

if not exist ".\bin" mkdir bin

copy packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml

Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"

echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install src/IO.Swagger/packages.config -o packages;

echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin;
cp packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;

echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace Example
{
public void main()
{

var apiInstance = new FakeApi();
var testCodeInjectEndRnNR = testCodeInjectEndRnNR_example; // string | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#

wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync

echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null

echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Contact: [email protected] *_/ ' \" =end - - \\r\\n \\n \\r
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
Expand All @@ -66,7 +66,8 @@ Contact: [email protected] *_/ ' \" =end - - \\r\\n \\n \\r
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs"/>
<Compile Include="**\*.cs"
Exclude="obj\**"/>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

using Newtonsoft.Json.Converters;

namespace IO.Swagger.Client
{
/// <summary>
/// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
/// </summary>
public class SwaggerDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
/// </summary>
public SwaggerDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,25 @@ Contact: [email protected] *_/ ' \" =end - - \\r\\n \\n \\r
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
</Reference>

</ItemGroup>
<ItemGroup>
<Compile Include="Api\**\*.cs"/>
<Compile Include="Client\**\*.cs"/>
<Compile Include="Model\**\*.cs"/>
<Compile Include="Properties\**\*.cs"/>
<Compile Include="**\*.cs"
Exclude="obj\**" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

</ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /></Project>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>

<dependency id="NewtonSoft.Json" version="8.0.3" />
<dependency id="NewtonSoft.Json" version="10.0.3" />
<dependency id="RestSharp" version="105.1.0" />

</dependencies>
Expand All @@ -36,5 +36,6 @@
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />

</files>
</package>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;

namespace IO.Swagger.Model
{
Expand All @@ -44,6 +45,7 @@ public ModelReturn(int? _Return = default(int?))
/// <value>property description *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r</value>
[DataMember(Name="return", EmitDefaultValue=false)]
public int? _Return { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/csharp/SwaggerClient/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319

if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\IO.Swagger\packages.config -o packages

if not exist ".\bin" mkdir bin
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/csharp/SwaggerClient/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"

echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install src/IO.Swagger/packages.config -o packages;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace Example
var number = 3.4; // decimal? | None
var _double = 1.2; // double? | None
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
var _byte = B; // byte[] | None
var _byte = _byte_example; // byte[] | None
var integer = 56; // int? | None (optional)
var int32 = 56; // int? | None (optional)
var int64 = 789; // long? | None (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#

wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync

echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null

echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatable
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for _String, must match a pattern of /[a-z]/i.", new [] { "_String" });
}

// _Byte (byte[]) pattern
Regex regex_Byte = new Regex(@"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$", RegexOptions.CultureInvariant);
if (false == regex_Byte.Match(this._Byte).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for _Byte, must match a pattern of /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.", new [] { "_Byte" });
}

// Password (string) maxLength
if(this.Password != null && this.Password.Length > 64)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace Example
var number = 3.4; // decimal? | None
var _double = 1.2; // double? | None
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
var _byte = B; // byte[] | None
var _byte = _byte_example; // byte[] | None
var integer = 56; // int? | None (optional)
var int32 = 56; // int? | None (optional)
var int64 = 789; // long? | None (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace Example
var number = 3.4; // decimal? | None
var _double = 1.2; // double? | None
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
var _byte = B; // byte[] | None
var _byte = _byte_example; // byte[] | None
var integer = 56; // int? | None (optional)
var int32 = 56; // int? | None (optional)
var int64 = 789; // long? | None (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319

if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\IO.Swagger\packages.config -o packages

if not exist ".\bin" mkdir bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"

echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe;
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install src/IO.Swagger/packages.config -o packages;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace Example
var number = 3.4; // decimal? | None
var _double = 1.2; // double? | None
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
var _byte = B; // byte[] | None
var _byte = _byte_example; // byte[] | None
var integer = 56; // int? | None (optional)
var int32 = 56; // int? | None (optional)
var int64 = 789; // long? | None (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#

wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync

echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null

echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@ IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatable
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for _String, must match a pattern of /[a-z]/i.", new [] { "_String" });
}

// _Byte (byte[]) pattern
Regex regex_Byte = new Regex(@"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$", RegexOptions.CultureInvariant);
if (false == regex_Byte.Match(this._Byte).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for _Byte, must match a pattern of /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.", new [] { "_Byte" });
}

// Password (string) maxLength
if(this.Password != null && this.Password.Length > 64)
{
Expand Down

0 comments on commit ef076c3

Please sign in to comment.