fix csharp constructor for model with read-only 1st property

This commit is contained in:
wing328 2016-05-21 22:42:37 +08:00
parent 46fe27a6f6
commit 69ec14d628
24 changed files with 674 additions and 54 deletions

View File

@ -25,6 +25,8 @@ public class CodegenModel {
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
public List<CodegenProperty> allVars; public List<CodegenProperty> allVars;
public Map<String, Object> allowableValues; public Map<String, Object> allowableValues;

View File

@ -2598,11 +2598,19 @@ public class DefaultCodegen {
addImport(m, cp.complexType); addImport(m, cp.complexType);
vars.add(cp); vars.add(cp);
if (Boolean.TRUE.equals(cp.required)) { // if required, add to the list "requiredVars" // if required, add to the list "requiredVars"
if (Boolean.TRUE.equals(cp.required)) {
m.requiredVars.add(cp); m.requiredVars.add(cp);
} else { // else add to the list "optionalVars" for optional property } else { // else add to the list "optionalVars" for optional property
m.optionalVars.add(cp); m.optionalVars.add(cp);
} }
// if readonly, add to readOnlyVars (list of properties)
if (Boolean.TRUE.equals(cp.isReadOnly)) {
m.readOnlyVars.add(cp);
} else { // else add to readWriteVars (list of properties)
m.readWriteVars.add(cp);
}
} }
} }
} }

View File

@ -39,7 +39,7 @@
/// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param> /// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param>
{{/isReadOnly}} {{/isReadOnly}}
{{/vars}} {{/vars}}
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) public {{classname}}({{#readWriteVars}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{^-last}}, {{/-last}}{{/readWriteVars}})
{ {
{{#vars}} {{#vars}}
{{^isReadOnly}} {{^isReadOnly}}

View File

@ -963,6 +963,14 @@ definitions:
additionalProperties: additionalProperties:
type: string type: string
$ref: '#/definitions/Animal' $ref: '#/definitions/Animal'
ReadOnlyFirst:
type: object
properties:
bar:
type: string
readOnly: true
baz:
type: string
externalDocs: externalDocs:
description: Find out more about Swagger description: Find out more about Swagger
url: 'http://swagger.io' url: 'http://swagger.io'

View File

@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
VisualStudioVersion = 12.0.0.0 VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1 MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{098D14FD-4F35-417E-9B8E-67875ACD0AD3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject EndProject
@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {098D14FD-4F35-417E-9B8E-67875ACD0AD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.Build.0 = Debug|Any CPU {098D14FD-4F35-417E-9B8E-67875ACD0AD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.ActiveCfg = Release|Any CPU {098D14FD-4F35-417E-9B8E-67875ACD0AD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.Build.0 = Release|Any CPU {098D14FD-4F35-417E-9B8E-67875ACD0AD3}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
- API version: 1.0.0 - API version: 1.0.0
- SDK version: 1.0.0 - SDK version: 1.0.0
- Build date: 2016-05-16T15:24:50.194+08:00 - Build date: 2016-05-21T22:36:46.367+08:00
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen - Build package: class io.swagger.codegen.languages.CSharpClientCodegen
## Frameworks supported ## Frameworks supported
@ -112,6 +112,7 @@ Class | Method | HTTP request | Description
## Documentation for Models ## Documentation for Models
- [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Model.Animal](docs/Animal.md) - [Model.Animal](docs/Animal.md)
- [Model.AnimalFarm](docs/AnimalFarm.md) - [Model.AnimalFarm](docs/AnimalFarm.md)
- [Model.ApiResponse](docs/ApiResponse.md) - [Model.ApiResponse](docs/ApiResponse.md)
@ -121,11 +122,13 @@ Class | Method | HTTP request | Description
- [Model.EnumClass](docs/EnumClass.md) - [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md) - [Model.EnumTest](docs/EnumTest.md)
- [Model.FormatTest](docs/FormatTest.md) - [Model.FormatTest](docs/FormatTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md) - [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelReturn](docs/ModelReturn.md) - [Model.ModelReturn](docs/ModelReturn.md)
- [Model.Name](docs/Name.md) - [Model.Name](docs/Name.md)
- [Model.Order](docs/Order.md) - [Model.Order](docs/Order.md)
- [Model.Pet](docs/Pet.md) - [Model.Pet](docs/Pet.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.SpecialModelName](docs/SpecialModelName.md) - [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md) - [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md) - [Model.User](docs/User.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -84,8 +84,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: Not defined - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
- **Accept**: application/xml, application/json - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Uuid** | **Guid?** | | [optional]
**DateTime** | **DateTime?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional]
**Baz** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -38,43 +38,36 @@
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <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('..\..\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> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="**\*.cs" /> <Compile Include="**\*.cs"/>
<Compile Include="Client\ApiClientTests.cs" />
<Compile Include="Client\ConfigurationTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj"> <ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
<Project>{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}</Project> <Project>{098D14FD-4F35-417E-9B8E-67875ACD0AD3}</Project>
<Name>IO.Swagger</Name> <Name>IO.Swagger</Name>
</ProjectReference> </ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="swagger-logo.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Client\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,56 @@
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using IO.Swagger.Api;
using IO.Swagger.Model;
using IO.Swagger.Client;
using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing AdditionalPropertiesClass
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class AdditionalPropertiesClassTests
{
private AdditionalPropertiesClass instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
instance = new AdditionalPropertiesClass();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of AdditionalPropertiesClass
/// </summary>
[Test]
public void AdditionalPropertiesClassInstanceTest()
{
Assert.IsInstanceOf<AdditionalPropertiesClass> (instance, "instance is a AdditionalPropertiesClass");
}
}
}

View File

@ -0,0 +1,72 @@
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using IO.Swagger.Api;
using IO.Swagger.Model;
using IO.Swagger.Client;
using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing MixedPropertiesAndAdditionalPropertiesClass
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class MixedPropertiesAndAdditionalPropertiesClassTests
{
private MixedPropertiesAndAdditionalPropertiesClass instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
instance = new MixedPropertiesAndAdditionalPropertiesClass();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of MixedPropertiesAndAdditionalPropertiesClass
/// </summary>
[Test]
public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest()
{
Assert.IsInstanceOf<MixedPropertiesAndAdditionalPropertiesClass> (instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass");
}
/// <summary>
/// Test the property 'Uuid'
/// </summary>
[Test]
public void UuidTest()
{
// TODO: unit test for the property 'Uuid'
}
/// <summary>
/// Test the property 'DateTime'
/// </summary>
[Test]
public void DateTimeTest()
{
// TODO: unit test for the property 'DateTime'
}
}
}

View File

@ -0,0 +1,72 @@
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using IO.Swagger.Api;
using IO.Swagger.Model;
using IO.Swagger.Client;
using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing ReadOnlyFirst
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class ReadOnlyFirstTests
{
private ReadOnlyFirst instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
instance = new ReadOnlyFirst();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of ReadOnlyFirst
/// </summary>
[Test]
public void ReadOnlyFirstInstanceTest()
{
Assert.IsInstanceOf<ReadOnlyFirst> (instance, "instance is a ReadOnlyFirst");
}
/// <summary>
/// Test the property 'Bar'
/// </summary>
[Test]
public void BarTest()
{
// TODO: unit test for the property 'Bar'
}
/// <summary>
/// Test the property 'Baz'
/// </summary>
[Test]
public void BazTest()
{
// TODO: unit test for the property 'Baz'
}
}
}

View File

@ -10,7 +10,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public interface IFakeApi public interface IFakeApi : IApiAccessor
{ {
#region Synchronous Operations #region Synchronous Operations
/// <summary> /// <summary>
@ -107,7 +107,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public class FakeApi : IFakeApi public partial class FakeApi : IFakeApi
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class. /// Initializes a new instance of the <see cref="FakeApi"/> class.
@ -157,7 +157,7 @@ namespace IO.Swagger.Api
/// Sets the base path of the API client. /// Sets the base path of the API client.
/// </summary> /// </summary>
/// <value>The base path</value> /// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath) public void SetBasePath(String basePath)
{ {
// do nothing // do nothing
@ -255,13 +255,15 @@ namespace IO.Swagger.Api
// to determine the Content-Type header // to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] { String[] localVarHttpContentTypes = new String[] {
"application/xml; charset=utf-8",
"application/json; charset=utf-8"
}; };
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header // to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] { String[] localVarHttpHeaderAccepts = new String[] {
"application/xml", "application/xml; charset=utf-8",
"application/json" "application/json; charset=utf-8"
}; };
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null) if (localVarHttpHeaderAccept != null)
@ -367,13 +369,15 @@ namespace IO.Swagger.Api
// to determine the Content-Type header // to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] { String[] localVarHttpContentTypes = new String[] {
"application/xml; charset=utf-8",
"application/json; charset=utf-8"
}; };
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header // to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] { String[] localVarHttpHeaderAccepts = new String[] {
"application/xml", "application/xml; charset=utf-8",
"application/json" "application/json; charset=utf-8"
}; };
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null) if (localVarHttpHeaderAccept != null)

View File

@ -11,7 +11,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public interface IPetApi public interface IPetApi : IApiAccessor
{ {
#region Synchronous Operations #region Synchronous Operations
/// <summary> /// <summary>
@ -378,7 +378,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public class PetApi : IPetApi public partial class PetApi : IPetApi
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class. /// Initializes a new instance of the <see cref="PetApi"/> class.
@ -428,7 +428,7 @@ namespace IO.Swagger.Api
/// Sets the base path of the API client. /// Sets the base path of the API client.
/// </summary> /// </summary>
/// <value>The base path</value> /// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath) public void SetBasePath(String basePath)
{ {
// do nothing // do nothing

View File

@ -11,7 +11,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public interface IStoreApi public interface IStoreApi : IApiAccessor
{ {
#region Synchronous Operations #region Synchronous Operations
/// <summary> /// <summary>
@ -186,7 +186,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public class StoreApi : IStoreApi public partial class StoreApi : IStoreApi
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class. /// Initializes a new instance of the <see cref="StoreApi"/> class.
@ -236,7 +236,7 @@ namespace IO.Swagger.Api
/// Sets the base path of the API client. /// Sets the base path of the API client.
/// </summary> /// </summary>
/// <value>The base path</value> /// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath) public void SetBasePath(String basePath)
{ {
// do nothing // do nothing

View File

@ -11,7 +11,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public interface IUserApi public interface IUserApi : IApiAccessor
{ {
#region Synchronous Operations #region Synchronous Operations
/// <summary> /// <summary>
@ -362,7 +362,7 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Represents a collection of functions to interact with the API endpoints /// Represents a collection of functions to interact with the API endpoints
/// </summary> /// </summary>
public class UserApi : IUserApi public partial class UserApi : IUserApi
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class. /// Initializes a new instance of the <see cref="UserApi"/> class.
@ -412,7 +412,7 @@ namespace IO.Swagger.Api
/// Sets the base path of the API client. /// Sets the base path of the API client.
/// </summary> /// </summary>
/// <value>The base path</value> /// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath) public void SetBasePath(String basePath)
{ {
// do nothing // do nothing

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
namespace IO.Swagger.Client
{
/// <summary>
/// Represents configuration aspects required to interact with the API endpoints.
/// </summary>
public interface IApiAccessor
{
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
Configuration Configuration {get; set;}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
String GetBasePath();
}
}

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}</ProjectGuid> <ProjectGuid>{098D14FD-4F35-417E-9B8E-67875ACD0AD3}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swagger Library</RootNamespace> <RootNamespace>Swagger Library</RootNamespace>

View File

@ -0,0 +1,89 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
/// AdditionalPropertiesClass
/// </summary>
[DataContract]
public partial class AdditionalPropertiesClass : Dictionary<String, string>, IEquatable<AdditionalPropertiesClass>
{
/// <summary>
/// Initializes a new instance of the <see cref="AdditionalPropertiesClass" /> class.
/// </summary>
public AdditionalPropertiesClass()
{
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class AdditionalPropertiesClass {\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public new string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as AdditionalPropertiesClass);
}
/// <summary>
/// Returns true if AdditionalPropertiesClass instances are equal
/// </summary>
/// <param name="other">Instance of AdditionalPropertiesClass to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(AdditionalPropertiesClass other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return false;
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
return hash;
}
}
}
}

View File

@ -0,0 +1,119 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
/// MixedPropertiesAndAdditionalPropertiesClass
/// </summary>
[DataContract]
public partial class MixedPropertiesAndAdditionalPropertiesClass : Dictionary<String, Animal>, IEquatable<MixedPropertiesAndAdditionalPropertiesClass>
{
/// <summary>
/// Initializes a new instance of the <see cref="MixedPropertiesAndAdditionalPropertiesClass" /> class.
/// </summary>
/// <param name="Uuid">Uuid.</param>
/// <param name="DateTime">DateTime.</param>
public MixedPropertiesAndAdditionalPropertiesClass(Guid? Uuid = null, DateTime? DateTime = null)
{
this.Uuid = Uuid;
this.DateTime = DateTime;
}
/// <summary>
/// Gets or Sets Uuid
/// </summary>
[DataMember(Name="uuid", EmitDefaultValue=false)]
public Guid? Uuid { get; set; }
/// <summary>
/// Gets or Sets DateTime
/// </summary>
[DataMember(Name="dateTime", EmitDefaultValue=false)]
public DateTime? DateTime { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public new string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as MixedPropertiesAndAdditionalPropertiesClass);
}
/// <summary>
/// Returns true if MixedPropertiesAndAdditionalPropertiesClass instances are equal
/// </summary>
/// <param name="other">Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(MixedPropertiesAndAdditionalPropertiesClass other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.Uuid == other.Uuid ||
this.Uuid != null &&
this.Uuid.Equals(other.Uuid)
) &&
(
this.DateTime == other.DateTime ||
this.DateTime != null &&
this.DateTime.Equals(other.DateTime)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.Uuid != null)
hash = hash * 59 + this.Uuid.GetHashCode();
if (this.DateTime != null)
hash = hash * 59 + this.DateTime.GetHashCode();
return hash;
}
}
}
}

View File

@ -0,0 +1,117 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
/// ReadOnlyFirst
/// </summary>
[DataContract]
public partial class ReadOnlyFirst : IEquatable<ReadOnlyFirst>
{
/// <summary>
/// Initializes a new instance of the <see cref="ReadOnlyFirst" /> class.
/// </summary>
/// <param name="Baz">Baz.</param>
public ReadOnlyFirst(string Baz = null)
{
this.Baz = Baz;
}
/// <summary>
/// Gets or Sets Bar
/// </summary>
[DataMember(Name="bar", EmitDefaultValue=false)]
public string Bar { get; private set; }
/// <summary>
/// Gets or Sets Baz
/// </summary>
[DataMember(Name="baz", EmitDefaultValue=false)]
public string Baz { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class ReadOnlyFirst {\n");
sb.Append(" Bar: ").Append(Bar).Append("\n");
sb.Append(" Baz: ").Append(Baz).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as ReadOnlyFirst);
}
/// <summary>
/// Returns true if ReadOnlyFirst instances are equal
/// </summary>
/// <param name="other">Instance of ReadOnlyFirst to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ReadOnlyFirst other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.Bar == other.Bar ||
this.Bar != null &&
this.Bar.Equals(other.Bar)
) &&
(
this.Baz == other.Baz ||
this.Baz != null &&
this.Baz.Equals(other.Baz)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.Bar != null)
hash = hash * 59 + this.Bar.GetHashCode();
if (this.Baz != null)
hash = hash * 59 + this.Baz.GetHashCode();
return hash;
}
}
}
}