Skip to content

Commit 3e736b7

Browse files
committed
fix: dotnet template issues
1 parent 07a7d62 commit 3e736b7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/SDK/Language/DotNet.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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,8 +497,8 @@ 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);
501+
$name = $this->toPascalCase($name);
502502
if (\in_array(\strtolower($name), $this->getKeywords())) {
503503
$name = '@' . $name;
504504
}

templates/dotnet/Package/Models/Model.cs.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
using System;
23
using System.Linq;
34
using 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 %}

0 commit comments

Comments
 (0)