From 98c5c5ffb6642770912faa4f5011ac3da70b99e0 Mon Sep 17 00:00:00 2001 From: Emil Weihe Date: Wed, 10 Jan 2024 16:00:29 +0100 Subject: [PATCH] Use PropertyName instead of actual JSON Name for record generation --- .../Templates/Class.Constructor.Record.liquid | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.Constructor.Record.liquid b/src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.Constructor.Record.liquid index 5f576efd8..f88b7e1b9 100644 --- a/src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.Constructor.Record.liquid +++ b/src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.Constructor.Record.liquid @@ -13,13 +13,13 @@ {%- else %} [Newtonsoft.Json.JsonConstructor] {%- endif %} -{% if IsAbstract %}protected{% else %}public{% endif %} {{ClassName}}({% for property in sortedProperties %}{%- if skipComma %}{%- assign skipComma = false %}{% else %}, {% endif %}{{ property.Type }} @{{ property.Name | lowercamelcase }}{% endfor %}) +{% if IsAbstract %}protected{% else %}public{% endif %} {{ClassName}}({% for property in sortedProperties %}{%- if skipComma %}{%- assign skipComma = false %}{% else %}, {% endif %}{{ property.Type }} @{{ property.PropertyName | lowercamelcase }}{% endfor %}) {%- assign skipComma = true %} {%- if HasInheritance %} - : base({%- for property in sortedParentProperties %}{%- if skipComma %}{%- assign skipComma = false %}{% else %}, {% endif %}{{ property.Name | lowercamelcase }}{%- endfor %}) + : base({%- for property in sortedParentProperties %}{%- if skipComma %}{%- assign skipComma = false %}{% else %}, {% endif %}{{ property.PropertyName | lowercamelcase }}{%- endfor %}) {%- endif %} { {%- for property in Properties %} - this.{{property.PropertyName}} = @{{property.Name | lowercamelcase}}; + this.{{property.PropertyName}} = @{{property.PropertyName | lowercamelcase}}; {%- endfor %} }