From eb3565b6c0cf56ce12891182a6643f7e82485ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 4 Apr 2017 08:38:47 +0200 Subject: [PATCH] [C#] Fix guid for C# security samples (#5283) * Issue #5196: also fix the packageGuid for the C# security samples. * Update C# security samples. --- bin/security/csharp-petstore.sh | 2 +- .../csharp/SwaggerClient/.gitignore | 52 +++++++++---------- .../csharp/SwaggerClient/.travis.yml | 12 ----- .../csharp/SwaggerClient/README.md | 32 +++++++++--- .../csharp/SwaggerClient/build.bat | 14 +---- .../csharp/SwaggerClient/build.sh | 12 +---- .../csharp/SwaggerClient/mono_nunit_test.sh | 15 +----- .../IO.Swagger.Test/IO.Swagger.Test.csproj | 22 ++------ .../src/IO.Swagger.Test/packages.config | 2 +- .../src/IO.Swagger/Api/FakeApi.cs | 18 ------- .../src/IO.Swagger/Client/ApiClient.cs | 12 ----- .../src/IO.Swagger/Client/ApiException.cs | 12 ----- .../src/IO.Swagger/Client/ApiResponse.cs | 12 ----- .../src/IO.Swagger/Client/Configuration.cs | 47 +++++++++++------ .../src/IO.Swagger/Client/ExceptionFactory.cs | 14 +---- .../src/IO.Swagger/Client/IApiAccessor.cs | 12 ----- .../src/IO.Swagger/IO.Swagger.csproj | 24 +++------ .../src/IO.Swagger/IO.Swagger.nuspec | 40 ++++++++++++++ .../src/IO.Swagger/Model/ModelReturn.cs | 28 +++++----- 19 files changed, 156 insertions(+), 226 deletions(-) create mode 100644 samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.nuspec diff --git a/bin/security/csharp-petstore.sh b/bin/security/csharp-petstore.sh index 375e33fac40..7153f4a2625 100755 --- a/bin/security/csharp-petstore.sh +++ b/bin/security/csharp-petstore.sh @@ -26,6 +26,6 @@ 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-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore b/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore index 56fef626922..d3f4f7b6f55 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/.gitignore @@ -147,39 +147,39 @@ UpgradeLog*.htm *.swp *.swo - # svn - .svn +# svn +.svn - # SQL Server files - **/App_Data/*.mdf - **/App_Data/*.ldf - **/App_Data/*.sdf +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf - #LightSwitch generated files - GeneratedArtifacts/ - _Pvt_Extensions/ - ModelManifest.xml +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml - # ========================= - # Windows detritus - # ========================= +# ========================= +# Windows detritus +# ========================= - # Windows image file caches - Thumbs.db - ehthumbs.db +# Windows image file caches +Thumbs.db +ehthumbs.db - # Folder config file - Desktop.ini +# Folder config file +Desktop.ini - # Recycle Bin used on file shares - $RECYCLE.BIN/ +# Recycle Bin used on file shares +$RECYCLE.BIN/ - # Mac desktop service store files - .DS_Store +# Mac desktop service store files +.DS_Store - # SASS Compiler cache - .sass-cache +# SASS Compiler cache +.sass-cache - # Visual Studio 2014 CTP - **/*.sln.ide +# Visual Studio 2014 CTP +**/*.sln.ide diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/.travis.yml b/samples/client/petstore-security-test/csharp/SwaggerClient/.travis.yml index 4096e0b50d4..805caf43c2c 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/.travis.yml +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/.travis.yml @@ -1,18 +1,6 @@ # # Generated by: https://github.com/swagger-api/swagger-codegen.git # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# language: csharp mono: - latest diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/README.md b/samples/client/petstore-security-test/csharp/SwaggerClient/README.md index 44f3ab7c368..53adb00b7d9 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/README.md +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/README.md @@ -6,18 +6,19 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r - SDK version: 1.0.0 -- Build date: 2016-07-13T18:16:08.689+08:00 -- Build package: class io.swagger.codegen.languages.CSharpClientCodegen +- Build package: io.swagger.codegen.languages.CSharpClientCodegen + ## Frameworks supported - .NET 4.0 or later - Windows Phone 7.1 (Mango) + ## Dependencies - [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later - [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later -The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` Install-Package RestSharp Install-Package Newtonsoft.Json @@ -25,6 +26,7 @@ Install-Package Newtonsoft.Json NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + ## Installation Run the following command to generate the DLL - [Mac/Linux] `/bin/sh build.sh` @@ -34,9 +36,22 @@ Then include the DLL (under the `bin` folder) in the C# project, and use the nam ```csharp using IO.Swagger.Api; using IO.Swagger.Client; -using Model; +using IO.Swagger.Model; +``` + +## Packaging + +A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. + +This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: + +``` +nuget pack -Build -OutputDirectory out IO.Swagger.csproj ``` +Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. + + ## Getting Started ```csharp @@ -44,7 +59,7 @@ using System; using System.Diagnostics; using IO.Swagger.Api; using IO.Swagger.Client; -using Model; +using IO.Swagger.Model; namespace Example { @@ -86,20 +101,23 @@ Class | Method | HTTP request | Description - [Model.ModelReturn](docs/ModelReturn.md) + ## Documentation for Authorization + ### api_key - **Type**: API key - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r - **Location**: HTTP header + ### petstore_auth - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - - write:pets: modify pets in your account */ ' " =end -- \r\n \n \r - - read:pets: read your pets */ ' " =end -- \r\n \n \r + - write:pets: modify pets in your account *_/ ' \" =end - - \\r\\n \\n \\r + - read:pets: read your pets *_/ ' \" =end - - \\r\\n \\n \\r diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/build.bat b/samples/client/petstore-security-test/csharp/SwaggerClient/build.bat index ae94b120d7b..1da4812b36b 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/build.bat +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/build.bat @@ -1,22 +1,10 @@ :: Generated by: https://github.com/swagger-api/swagger-codegen.git :: -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. @echo off 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')" .\nuget.exe install src\IO.Swagger\packages.config -o packages @@ -24,5 +12,5 @@ if not exist ".\bin" mkdir bin copy packages\Newtonsoft.Json.8.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 -%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh b/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh index 25228f3cc36..6cfe5890b5e 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/build.sh @@ -2,17 +2,6 @@ # # Generated by: https://github.com/swagger-api/swagger-codegen.git # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. frameworkVersion=net45 netfx=${frameworkVersion#net} @@ -32,6 +21,7 @@ cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll" mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ +System.ComponentModel.DataAnnotations.dll,\ System.Runtime.Serialization.dll \ -target:library \ -out:bin/IO.Swagger.dll \ diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/mono_nunit_test.sh b/samples/client/petstore-security-test/csharp/SwaggerClient/mono_nunit_test.sh index e7032942787..6e094f7c0d1 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/mono_nunit_test.sh +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/mono_nunit_test.sh @@ -2,17 +2,6 @@ # # Generated by: https://github.com/swagger-api/swagger-codegen.git # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. wget -nc https://nuget.org/nuget.exe mozroots --import --sync @@ -26,8 +15,8 @@ mozroots --import --sync mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages +mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild IO.Swagger.sln && \ - mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll + mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index dc7be6546d9..a411e76e751 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -6,19 +6,6 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. --> @@ -54,6 +41,7 @@ limitations under the License. + @@ -71,10 +59,10 @@ limitations under the License. ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\..\vendor\NUnit.3.2.1\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config index 317248179b6..9bb00f0fc4f 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config @@ -1,6 +1,6 @@ - + diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 6e318d45644..e9ded41c0a5 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; @@ -235,9 +223,6 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter @@ -305,9 +290,6 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs index 20335049b73..0763aa3ce27 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs index f66ab06f6eb..2c5759c335c 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs index 14ececaeed0..0c162cdd298 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs index 93b6e0f78ec..a816f96ecee 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; @@ -179,7 +167,28 @@ namespace IO.Swagger.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap.Add(key, value); + _defaultHeaderMap[key] = value; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; } /// @@ -234,7 +243,7 @@ namespace IO.Swagger.Client return apiKeyValue; } - private string _tempFolderPath = Path.GetTempPath(); + private string _tempFolderPath; /// /// Gets or sets the temporary folder path to store the files downloaded from the server. @@ -242,7 +251,15 @@ namespace IO.Swagger.Client /// Folder path. public String TempFolderPath { - get { return _tempFolderPath; } + get + { + // default to Path.GetTempPath() if _tempFolderPath is not set + if (String.IsNullOrEmpty(_tempFolderPath)) + { + _tempFolderPath = Path.GetTempPath(); + } + return _tempFolderPath; + } set { diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs index 6b9dfb4a29c..0b1a4fc617b 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -31,6 +19,6 @@ namespace IO.Swagger.Client /// /// Method name /// Response - /// Exceptions + /// Exceptions public delegate Exception ExceptionFactory(string methodName, IRestResponse response); } diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs index ed52eb5c858..af6d4c1a1e5 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs @@ -6,18 +6,6 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 7b80b107d42..c5f0a9ec4ea 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -6,29 +6,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. --> + Debug AnyCPU {8CE139DF-64BC-4591-85F8-8506C2B67514} Library Properties - Swagger Library - Swagger Library + IO.Swagger + IO.Swagger v4.5 512 @@ -54,6 +42,7 @@ limitations under the License. + @@ -70,13 +59,14 @@ limitations under the License. ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + + - - + diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.nuspec b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.nuspec new file mode 100644 index 00000000000..26e30c91e78 --- /dev/null +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.nuspec @@ -0,0 +1,40 @@ + + + + + $id$ + Swagger Library + + + $version$ + + + $author$ + + + $author$ + false + false + + + A library generated from a Swagger doc + http://swagger.io/terms/ *_/ ' \" =end - - \\r\\n \\n \\r + http://www.apache.org/licenses/LICENSE-2.0.html *_/ ' \" =end - - \\r\\n \\n \\r + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs index e8bad487f7d..ebb142f3847 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs @@ -6,30 +6,20 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ using System; using System.Linq; using System.IO; using System.Text; +using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; namespace IO.Swagger.Model { @@ -37,13 +27,13 @@ namespace IO.Swagger.Model /// Model for testing reserved words *_/ ' \" =end - - \\r\\n \\n \\r /// [DataContract] - public partial class ModelReturn : IEquatable + public partial class ModelReturn : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// /// property description *_/ ' \" =end - - \\r\\n \\n \\r. - public ModelReturn(int? _Return = null) + public ModelReturn(int? _Return = default(int?)) { this._Return = _Return; } @@ -122,6 +112,16 @@ namespace IO.Swagger.Model return hash; } } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } } }