Skip to content
Closed
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 @@ -167,6 +167,7 @@ public static string GetTypescriptTypeString(CodeTypeBase code, CodeElement targ
* @param targetElement The target element
* @returns The composed type string representation
*/

private static string GetComposedTypeTypeString(CodeComposedTypeBase composedType, CodeElement targetElement, string collectionSuffix, bool includeCollectionInformation = true)
{
if (!composedType.Types.Any())
Expand Down Expand Up @@ -347,6 +348,14 @@ public static string GetFactoryMethodName(CodeTypeBase targetClassType, CodeElem
return definitionClass.GetImmediateParentOfType<CodeFile>(definitionClass)?.FindChildByName<CodeFunction>(factoryMethodName);
}

public override string GetPropertyName(string originalName)
{
if (originalName.StartsWith("__"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fix is super specific to this use case, it should most likely be fixed in the generation code instead.

Here is where the switch statement gets written

writer.StartBlock($"switch ({param.Name.ToFirstCharacterLowerCase()}.{discriminatorProperty.Name.ToFirstCharacterLowerCase()}) {{");

(should use the symbol name instead, and avoid normalizing the casing)

Here is where it gets tested

Assert.Contains("switch (parentClass.odataType) {", result);

return originalName; // Don't transform property names starting with double underscore

return base.GetPropertyName(originalName); // fallback to default
}

public string GetDeserializationMethodName(CodeTypeBase codeType, CodeElement targetElement, bool? IsCollection = null)
{
ArgumentNullException.ThrowIfNull(codeType);
Expand Down