Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/SDK/Language/DotNet.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,13 @@ public function getFunctions(): array

if (isset($property['sub_schema']) && !empty($property['sub_schema'])) {
if ($property['type'] === 'array') {
$result = 'List<' . \ucfirst($property['sub_schema']) . '>';
$result = 'List<' . $this->toPascalCase($property['sub_schema']) . '>';
} else {
$result = \ucfirst($property['sub_schema']);
$result = $this->toPascalCase($property['sub_schema']);
}
} elseif (isset($property['enum']) && !empty($property['enum'])) {
$enumName = $property['enumName'] ?? $property['name'];
$result = \ucfirst($enumName);
$result = $this->toPascalCase($enumName);
} else {
$result = $this->getTypeName($property);
}
Expand All @@ -497,8 +497,8 @@ public function getFunctions(): array
}),
new TwigFunction('property_name', function (array $definition, array $property) {
$name = $property['name'];
$name = \ucfirst($name);
$name = \str_replace('$', '', $name);
$name = $this->toPascalCase($name);
if (\in_array(\strtolower($name), $this->getKeywords())) {
$name = '@' . $name;
}
Expand Down
5 changes: 3 additions & 2 deletions templates/dotnet/Package/Models/Model.cs.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

using System;
using System.Linq;
using System.Collections.Generic;
Expand All @@ -11,7 +12,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
{
{%~ for property in definition.properties %}
[JsonPropertyName("{{ property.name }}")]
public {{ sub_schema(property) }} {{ property_name(definition, property) | overrideProperty(definition.name) }} { get; private set; }
public {{ sub_schema(property) | raw }} {{ property_name(definition, property) | overrideProperty(definition.name) }} { get; private set; }

{%~ endfor %}
{%~ if definition.additionalProperties %}
Expand All @@ -20,7 +21,7 @@ namespace {{ spec.title | caseUcfirst }}.Models
{%~ endif %}
public {{ definition.name | caseUcfirst | overrideIdentifier }}(
{%~ for property in definition.properties %}
{{ sub_schema(property) }} {{ property.name | caseCamel | escapeKeyword }}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %}
{{ sub_schema(property) | raw }} {{ property.name | caseCamel | escapeKeyword }}{% if not loop.last or (loop.last and definition.additionalProperties) %},{% endif %}

{%~ endfor %}
{%~ if definition.additionalProperties %}
Expand Down