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
478
478
479
479
if (isset ($ property ['sub_schema ' ]) && !empty ($ property ['sub_schema ' ])) {
480
480
if ($ property ['type ' ] === 'array ' ) {
481
- $ result = 'List< ' . \ucfirst ($ property ['sub_schema ' ]) . '> ' ;
481
+ $ result = 'List< ' . $ this -> toPascalCase ($ property ['sub_schema ' ]) . '> ' ;
482
482
} else {
483
- $ result = \ucfirst ($ property ['sub_schema ' ]);
483
+ $ result = $ this -> toPascalCase ($ property ['sub_schema ' ]);
484
484
}
485
485
} elseif (isset ($ property ['enum ' ]) && !empty ($ property ['enum ' ])) {
486
486
$ enumName = $ property ['enumName ' ] ?? $ property ['name ' ];
487
- $ result = \ucfirst ($ enumName );
487
+ $ result = $ this -> toPascalCase ($ enumName );
488
488
} else {
489
489
$ result = $ this ->getTypeName ($ property );
490
490
}
@@ -497,9 +497,9 @@ public function getFunctions(): array
497
497
}),
498
498
new TwigFunction ('property_name ' , function (array $ definition , array $ property ) {
499
499
$ name = $ property ['name ' ];
500
- $ name = \ucfirst ($ name );
501
500
$ name = \str_replace ('$ ' , '' , $ name );
502
- if (\in_array (\strtolower ($ name ), $ this ->getKeywords ())) {
501
+ $ name = $ this ->toPascalCase ($ name );
502
+ if (\in_array ($ name , $ this ->getKeywords ())) {
503
503
$ name = '@ ' . $ name ;
504
504
}
505
505
return $ name ;
Original file line number Diff line number Diff line change
1
+
1
2
using System;
2
3
using System.Linq;
3
4
using System.Collections.Generic;
@@ -11,7 +12,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
11
12
{
12
13
{%~ for property in definition .properties %}
13
14
[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; }
15
16
16
17
{%~ endfor %}
17
18
{%~ if definition .additionalProperties %}
@@ -20,7 +21,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
20
21
{%~ endif %}
21
22
public {{ definition .name | caseUcfirst | overrideIdentifier }}(
22
23
{%~ 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 %}
24
25
25
26
{%~ endfor %}
26
27
{%~ if definition .additionalProperties %}
You can’t perform that action at this time.
0 commit comments