Skip to content

Commit e1ca749

Browse files
authored
Merge pull request #1205 from appwrite/fix-dotnet-issues
2 parents 07a7d62 + 112022a commit e1ca749

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/SDK/Language/DotNet.php

Lines changed: 5 additions & 5 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,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;

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)