Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class GenerateContentForEnum : IContentGenerator
{
private readonly ICodeDocumentationTagsGenerator codeDocumentationTagsGenerator;
private readonly EnumParameters parameters;
private readonly char[] removeSeparatorsForName = { ' ', '-', '_', ':' };

public GenerateContentForEnum(
ICodeDocumentationTagsGenerator codeDocumentationTagsGenerator,
Expand Down Expand Up @@ -57,8 +58,10 @@ public string Generate()
}
else
{
var name = parametersValue.Name.PascalCase(removeSeparatorsForName, true);

sbLine.AppendLine($"[EnumMember(Value = \"{parametersValue.Name}\")]");
sbLine.Append(4, parametersValue.Name.PascalCase(removeSeparators: true));
sbLine.Append(4, name);
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static EnumParameters Create(
{
case 1:
result.Add(
key: sa[0].Trim().Replace(":", "-", StringComparison.CurrentCulture),
key: sa[0].Trim(),
value: null);
break;
case 2:
Expand Down
16 changes: 16 additions & 0 deletions test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Monta/Monta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15250,6 +15250,22 @@ components:
- created
- updated
- deleted
- scanned
- monta:ocpp:OcppRequestResponse
- monta:ocpp:ChargePointConnected
- monta:ocpp:ChargePointDisconnected
- monta:ocpp:OcppProtocolError
- monta:ocpp:OcppRequestTimeout
x-enum-varnames:
- CREATED
- UPDATED
- DELETED
- SCANNED
- OCPP_REQUEST_RESPONSE
- CHARGE_POINT_CONNECTED
- CHARGE_POINT_DISCONNECTED
- OCPP_PROTOCOL_ERROR
- OCPP_REQUEST_TIMEOUT
KwhPerHour:
required:
- time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,22 @@ public enum KafkaEventType

[EnumMember(Value = "deleted")]
Deleted,

[EnumMember(Value = "scanned")]
Scanned,

[EnumMember(Value = "monta:ocpp:OcppRequestResponse")]
MontaOcppOcppRequestResponse,

[EnumMember(Value = "monta:ocpp:ChargePointConnected")]
MontaOcppChargePointConnected,

[EnumMember(Value = "monta:ocpp:ChargePointDisconnected")]
MontaOcppChargePointDisconnected,

[EnumMember(Value = "monta:ocpp:OcppProtocolError")]
MontaOcppOcppProtocolError,

[EnumMember(Value = "monta:ocpp:OcppRequestTimeout")]
MontaOcppOcppRequestTimeout,
}