mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-14 04:40:51 +00:00
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.Serialization;
|
|
using Newtonsoft.Json;
|
|
|
|
{{#models}}
|
|
{{#model}}
|
|
namespace {{packageName}}.Model {
|
|
|
|
/// <summary>
|
|
/// {{description}}
|
|
/// </summary>
|
|
[DataContract]
|
|
public class {{classname}}{{#parent}} : {{{parent}}}{{/parent}} {
|
|
{{#vars}}
|
|
/// <summary>
|
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
|
/// </summary>{{#description}}
|
|
/// <value>{{{description}}}</value>{{/description}}
|
|
[DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
|
|
public {{{datatype}}} {{name}} { get; set; }
|
|
|
|
{{/vars}}
|
|
|
|
/// <summary>
|
|
/// Get 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 {{classname}} {\n");
|
|
{{#vars}}
|
|
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
|
{{/vars}}
|
|
sb.Append("}\n");
|
|
return sb.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the JSON string presentation of the object
|
|
/// </summary>
|
|
/// <returns>JSON string presentation of the object</returns>
|
|
public {{#parent}} new {{/parent}}string ToJson() {
|
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
|
}
|
|
|
|
}
|
|
{{/model}}
|
|
{{/models}}
|
|
}
|