Skip to content

Commit 71a49b4

Browse files
committed
add OnCreated to JsonConverter
1 parent 83f31cb commit 71a49b4

1,793 files changed

Lines changed: 20005 additions & 2075 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
/// <summary>
22
/// A Json converter for type <see cref="{{classname}}" />
33
/// </summary>
4-
{{>visibility}} class {{classname}}JsonConverter : JsonConverter<{{classname}}>
4+
{{>visibility}} partial class {{classname}}JsonConverter : JsonConverter<{{classname}}>
55
{
6+
partial void OnCreated();
7+
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="{{classname}}JsonConverter" /> class.
10+
/// </summary>
11+
public {{classname}}JsonConverter()
12+
{
13+
OnCreated();
14+
}
15+
616
{{#allVars}}
717
{{#isDateTime}}
818
/// <summary>
919
/// The format to use to serialize {{name}}
1020
/// </summary>
11-
public static string {{name}}Format { get; set; } = "{{{dateTimeFormat}}}";
21+
public string {{name}}Format { get; private set; } = "{{{dateTimeFormat}}}";
1222

1323
{{/isDateTime}}
1424
{{#isDate}}
1525
/// <summary>
1626
/// The format to use to serialize {{name}}
1727
/// </summary>
18-
public static string {{name}}Format { get; set; } = "{{{dateFormat}}}";
28+
public string {{name}}Format { get; private set; } = "{{{dateFormat}}}";
1929

2030
{{/isDate}}
2131
{{/allVars}}

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Model/HelloWorldPostRequest.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
8383
/// <summary>
8484
/// A Json converter for type <see cref="HelloWorldPostRequest" />
8585
/// </summary>
86-
public class HelloWorldPostRequestJsonConverter : JsonConverter<HelloWorldPostRequest>
86+
public partial class HelloWorldPostRequestJsonConverter : JsonConverter<HelloWorldPostRequest>
8787
{
88+
partial void OnCreated();
89+
90+
/// <summary>
91+
/// Initializes a new instance of the <see cref="HelloWorldPostRequestJsonConverter" /> class.
92+
/// </summary>
93+
public HelloWorldPostRequestJsonConverter()
94+
{
95+
OnCreated();
96+
}
97+
8898
/// <summary>
8999
/// Deserializes json to <see cref="HelloWorldPostRequest" />
90100
/// </summary>

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/Foo.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
8383
/// <summary>
8484
/// A Json converter for type <see cref="Foo" />
8585
/// </summary>
86-
public class FooJsonConverter : JsonConverter<Foo>
86+
public partial class FooJsonConverter : JsonConverter<Foo>
8787
{
88+
partial void OnCreated();
89+
90+
/// <summary>
91+
/// Initializes a new instance of the <see cref="FooJsonConverter" /> class.
92+
/// </summary>
93+
public FooJsonConverter()
94+
{
95+
OnCreated();
96+
}
97+
8898
/// <summary>
8999
/// Deserializes json to <see cref="Foo" />
90100
/// </summary>

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsDefaultResponse.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
8383
/// <summary>
8484
/// A Json converter for type <see cref="IconsDefaultResponse" />
8585
/// </summary>
86-
public class IconsDefaultResponseJsonConverter : JsonConverter<IconsDefaultResponse>
86+
public partial class IconsDefaultResponseJsonConverter : JsonConverter<IconsDefaultResponse>
8787
{
88+
partial void OnCreated();
89+
90+
/// <summary>
91+
/// Initializes a new instance of the <see cref="IconsDefaultResponseJsonConverter" /> class.
92+
/// </summary>
93+
public IconsDefaultResponseJsonConverter()
94+
{
95+
OnCreated();
96+
}
97+
8898
/// <summary>
8999
/// Deserializes json to <see cref="IconsDefaultResponse" />
90100
/// </summary>

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsSizeParameter.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
9494
/// <summary>
9595
/// A Json converter for type <see cref="IconsSizeParameter" />
9696
/// </summary>
97-
public class IconsSizeParameterJsonConverter : JsonConverter<IconsSizeParameter>
97+
public partial class IconsSizeParameterJsonConverter : JsonConverter<IconsSizeParameter>
9898
{
99+
partial void OnCreated();
100+
101+
/// <summary>
102+
/// Initializes a new instance of the <see cref="IconsSizeParameterJsonConverter" /> class.
103+
/// </summary>
104+
public IconsSizeParameterJsonConverter()
105+
{
106+
OnCreated();
107+
}
108+
99109
/// <summary>
100110
/// Deserializes json to <see cref="IconsSizeParameter" />
101111
/// </summary>

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Color.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
151151
/// <summary>
152152
/// A Json converter for type <see cref="Color" />
153153
/// </summary>
154-
public class ColorJsonConverter : JsonConverter<Color>
154+
public partial class ColorJsonConverter : JsonConverter<Color>
155155
{
156+
partial void OnCreated();
157+
158+
/// <summary>
159+
/// Initializes a new instance of the <see cref="ColorJsonConverter" /> class.
160+
/// </summary>
161+
public ColorJsonConverter()
162+
{
163+
OnCreated();
164+
}
165+
156166
/// <summary>
157167
/// Deserializes json to <see cref="Color" />
158168
/// </summary>

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ColorOrNull.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
9494
/// <summary>
9595
/// A Json converter for type <see cref="ColorOrNull" />
9696
/// </summary>
97-
public class ColorOrNullJsonConverter : JsonConverter<ColorOrNull>
97+
public partial class ColorOrNullJsonConverter : JsonConverter<ColorOrNull>
9898
{
99+
partial void OnCreated();
100+
101+
/// <summary>
102+
/// Initializes a new instance of the <see cref="ColorOrNullJsonConverter" /> class.
103+
/// </summary>
104+
public ColorOrNullJsonConverter()
105+
{
106+
OnCreated();
107+
}
108+
99109
/// <summary>
100110
/// Deserializes json to <see cref="ColorOrNull" />
101111
/// </summary>

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/NullTypeDirect.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
100100
/// <summary>
101101
/// A Json converter for type <see cref="NullTypeDirect" />
102102
/// </summary>
103-
public class NullTypeDirectJsonConverter : JsonConverter<NullTypeDirect>
103+
public partial class NullTypeDirectJsonConverter : JsonConverter<NullTypeDirect>
104104
{
105+
partial void OnCreated();
106+
107+
/// <summary>
108+
/// Initializes a new instance of the <see cref="NullTypeDirectJsonConverter" /> class.
109+
/// </summary>
110+
public NullTypeDirectJsonConverter()
111+
{
112+
OnCreated();
113+
}
114+
105115
/// <summary>
106116
/// Deserializes json to <see cref="NullTypeDirect" />
107117
/// </summary>

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
9494
/// <summary>
9595
/// A Json converter for type <see cref="Shape" />
9696
/// </summary>
97-
public class ShapeJsonConverter : JsonConverter<Shape>
97+
public partial class ShapeJsonConverter : JsonConverter<Shape>
9898
{
99+
partial void OnCreated();
100+
101+
/// <summary>
102+
/// Initializes a new instance of the <see cref="ShapeJsonConverter" /> class.
103+
/// </summary>
104+
public ShapeJsonConverter()
105+
{
106+
OnCreated();
107+
}
108+
99109
/// <summary>
100110
/// Deserializes json to <see cref="Shape" />
101111
/// </summary>

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
9494
/// <summary>
9595
/// A Json converter for type <see cref="ShapeOrNull" />
9696
/// </summary>
97-
public class ShapeOrNullJsonConverter : JsonConverter<ShapeOrNull>
97+
public partial class ShapeOrNullJsonConverter : JsonConverter<ShapeOrNull>
9898
{
99+
partial void OnCreated();
100+
101+
/// <summary>
102+
/// Initializes a new instance of the <see cref="ShapeOrNullJsonConverter" /> class.
103+
/// </summary>
104+
public ShapeOrNullJsonConverter()
105+
{
106+
OnCreated();
107+
}
108+
99109
/// <summary>
100110
/// Deserializes json to <see cref="ShapeOrNull" />
101111
/// </summary>

0 commit comments

Comments
 (0)