forked from loafle/openapi-generator-original
[C#] fix the location of FodyWeavers.xml (#3782)
* fix fody weavers xml location * update c# petstore sample
This commit is contained in:
@@ -253,7 +253,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
if(Boolean.TRUE.equals(generatePropertyChanged)) {
|
||||
supportingFiles.add(new SupportingFile("FodyWeavers.xml", "", "FodyWeavers.xml"));
|
||||
supportingFiles.add(new SupportingFile("FodyWeavers.xml", packageFolder, "FodyWeavers.xml"));
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Ref: https://github.com/Fody/Fody -->
|
||||
<Weavers>
|
||||
<PropertyChanged/>
|
||||
</Weavers>
|
||||
</Weavers>
|
||||
|
||||
@@ -9,8 +9,10 @@ using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
{{#generatePropertyChanged}}using PropertyChanged;
|
||||
using System.ComponentModel;{{/generatePropertyChanged}}
|
||||
{{#generatePropertyChanged}}
|
||||
using PropertyChanged;
|
||||
using System.ComponentModel;
|
||||
{{/generatePropertyChanged}}
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/// <summary>
|
||||
/// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
/// </summary>
|
||||
[DataContract]{{#generatePropertyChanged}}
|
||||
[ImplementPropertyChanged]{{/generatePropertyChanged}}
|
||||
[DataContract]
|
||||
{{#generatePropertyChanged}}
|
||||
[ImplementPropertyChanged]
|
||||
{{/generatePropertyChanged}}
|
||||
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
||||
{
|
||||
{{#vars}}
|
||||
@@ -181,5 +183,6 @@ this.{{name}} = {{name}};
|
||||
{
|
||||
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}{{/generatePropertyChanged}}
|
||||
}
|
||||
{{/generatePropertyChanged}}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<packages>
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
{{#generatePropertyChanged}}<package id="Fody" version="1.29.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />{{/generatePropertyChanged}}
|
||||
{{#generatePropertyChanged}}
|
||||
<package id="Fody" version="1.29.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
{{/generatePropertyChanged}}
|
||||
</packages>
|
||||
|
||||
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
VisualStudioVersion = 12.0.0.0
|
||||
MinimumVisualStudioVersion = 10.0.0.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{497E0E11-BFD7-4CB3-BA32-A19285FBB551}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1F7D41FE-F060-43E8-8866-F14DA42E2A22}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
|
||||
EndProject
|
||||
@@ -12,17 +12,10 @@ Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
<<<<<<< HEAD
|
||||
{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{497E0E11-BFD7-4CB3-BA32-A19285FBB551}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
=======
|
||||
{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{852B5B14-5D2E-4A76-AA16-DCA2E8B4CCCB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
>>>>>>> 3d717bd87491572a1fdca4b146f0666a8f67bccb
|
||||
{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F7D41FE-F060-43E8-8866-F14DA42E2A22}.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.Build.0 = Debug|Any CPU
|
||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -31,4 +24,4 @@ EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
EndGlobal
|
||||
@@ -138,16 +138,19 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
<a name="api_key"></a>
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
<a name="http_basic_test"></a>
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
<a name="petstore_auth"></a>
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@@ -157,7 +160,3 @@ Class | Method | HTTP request | Description
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# IO.Swagger.Model.EnumArrays
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<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)
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
* 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 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 EnumArrays
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by Swagger Codegen.
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public class EnumArraysTests
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for EnumArrays
|
||||
//private EnumArrays instance;
|
||||
|
||||
/// <summary>
|
||||
/// Setup before each test
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
// TODO uncomment below to create an instance of EnumArrays
|
||||
//instance = new EnumArrays();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up after each test
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of EnumArrays
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void EnumArraysInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsInstanceOfType" EnumArrays
|
||||
//Assert.IsInstanceOfType<EnumArrays> (instance, "variable 'instance' is a EnumArrays");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'JustSymbol'
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void JustSymbolTest()
|
||||
{
|
||||
// TODO unit test for the property 'JustSymbol'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property 'ArrayEnum'
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ArrayEnumTest()
|
||||
{
|
||||
// TODO unit test for the property 'ArrayEnum'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ limitations under the License.
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{497E0E11-BFD7-4CB3-BA32-A19285FBB551}</ProjectGuid>
|
||||
<ProjectGuid>{1F7D41FE-F060-43E8-8866-F14DA42E2A22}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IO.Swagger</RootNamespace>
|
||||
@@ -70,13 +70,14 @@ limitations under the License.
|
||||
<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="**\*.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
</ItemGroup>
|
||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /></Project>
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
* 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.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>
|
||||
/// EnumArrays
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class EnumArrays : IEquatable<EnumArrays>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets JustSymbol
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum JustSymbolEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum GreaterThanOrEqualTo for ">="
|
||||
/// </summary>
|
||||
[EnumMember(Value = ">=")]
|
||||
GreaterThanOrEqualTo,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Dollar for "$"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "$")]
|
||||
Dollar
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ArrayEnumEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Fish for "fish"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "fish")]
|
||||
Fish,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Crab for "crab"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "crab")]
|
||||
Crab
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets JustSymbol
|
||||
/// </summary>
|
||||
[DataMember(Name="just_symbol", EmitDefaultValue=false)]
|
||||
public JustSymbolEnum? JustSymbol { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[DataMember(Name="array_enum", EmitDefaultValue=false)]
|
||||
public List<ArrayEnumEnum> ArrayEnum { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EnumArrays" /> class.
|
||||
/// </summary>
|
||||
/// <param name="JustSymbol">JustSymbol.</param>
|
||||
/// <param name="ArrayEnum">ArrayEnum.</param>
|
||||
public EnumArrays(JustSymbolEnum? JustSymbol = null, List<ArrayEnumEnum> ArrayEnum = null)
|
||||
{
|
||||
this.JustSymbol = JustSymbol;
|
||||
this.ArrayEnum = ArrayEnum;
|
||||
}
|
||||
|
||||
/// <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 EnumArrays {\n");
|
||||
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
|
||||
sb.Append(" ArrayEnum: ").Append(ArrayEnum).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 EnumArrays);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if EnumArrays instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of EnumArrays to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(EnumArrays other)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return
|
||||
(
|
||||
this.JustSymbol == other.JustSymbol ||
|
||||
this.JustSymbol != null &&
|
||||
this.JustSymbol.Equals(other.JustSymbol)
|
||||
) &&
|
||||
(
|
||||
this.ArrayEnum == other.ArrayEnum ||
|
||||
this.ArrayEnum != null &&
|
||||
this.ArrayEnum.SequenceEqual(other.ArrayEnum)
|
||||
);
|
||||
}
|
||||
|
||||
/// <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.JustSymbol != null)
|
||||
hash = hash * 59 + this.JustSymbol.GetHashCode();
|
||||
if (this.ArrayEnum != null)
|
||||
hash = hash * 59 + this.ArrayEnum.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user