File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
templates/dotnet/Package/Models Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -478,13 +478,13 @@ public function getFunctions(): array
478478
479479 if (isset ($ property ['sub_schema ' ]) && !empty ($ property ['sub_schema ' ])) {
480480 if ($ property ['type ' ] === 'array ' ) {
481- $ result = 'List< ' . \ucfirst ($ property ['sub_schema ' ]) . '> ' ;
481+ $ result = 'List< ' . $ this -> toPascalCase ($ property ['sub_schema ' ]) . '> ' ;
482482 } else {
483- $ result = \ucfirst ($ property ['sub_schema ' ]);
483+ $ result = $ this -> toPascalCase ($ property ['sub_schema ' ]);
484484 }
485485 } elseif (isset ($ property ['enum ' ]) && !empty ($ property ['enum ' ])) {
486486 $ enumName = $ property ['enumName ' ] ?? $ property ['name ' ];
487- $ result = \ucfirst ($ enumName );
487+ $ result = $ this -> toPascalCase ($ enumName );
488488 } else {
489489 $ result = $ this ->getTypeName ($ property );
490490 }
@@ -497,9 +497,9 @@ public function getFunctions(): array
497497 }),
498498 new TwigFunction ('property_name ' , function (array $ definition , array $ property ) {
499499 $ name = $ property ['name ' ];
500- $ name = \ucfirst ($ name );
501500 $ name = \str_replace ('$ ' , '' , $ name );
502- if (\in_array (\strtolower ($ name ), $ this ->getKeywords ())) {
501+ $ name = $ this ->toPascalCase ($ name );
502+ if (\in_array ($ name , $ this ->getKeywords ())) {
503503 $ name = '@ ' . $ name ;
504504 }
505505 return $ name ;
Original file line number Diff line number Diff line change 1+
12using System;
23using System.Linq;
34using System.Collections.Generic;
@@ -11,7 +12,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
1112 {
1213 {%~ for property in definition .properties %}
1314 [JsonPropertyName("{{ property .name }}")]
14- public {{ sub_schema(property ) }} {{ property_name(definition , property ) | overrideProperty(definition .name ) }} { get; private set; }
15+ public {{ sub_schema(property ) | raw }} {{ property_name(definition , property ) | overrideProperty(definition .name ) }} { get; private set; }
1516
1617 {%~ endfor %}
1718 {%~ if definition .additionalProperties %}
@@ -20,7 +21,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
2021 {%~ endif %}
2122 public {{ definition .name | caseUcfirst | overrideIdentifier }}(
2223 {%~ for property in definition .properties %}
23- {{ sub_schema(property ) }} {{ property .name | caseCamel | escapeKeyword }}{% if not loop .last or (loop .last and definition .additionalProperties ) %},{% endif %}
24+ {{ sub_schema(property ) | raw }} {{ property .name | caseCamel | escapeKeyword }}{% if not loop .last or (loop .last and definition .additionalProperties ) %},{% endif %}
2425
2526 {%~ endfor %}
2627 {%~ if definition .additionalProperties %}
You can’t perform that action at this time.
0 commit comments