-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
176 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
/** Generated type representing the anonymous struct variant `List` of the `AnonymousStructWithRename` Rust enum */ | ||
public class AnonymousStructWithRenameListInner { | ||
public IEnumerable<string> list { get; set; } | ||
} | ||
|
||
/** Generated type representing the anonymous struct variant `LongFieldNames` of the `AnonymousStructWithRename` Rust enum */ | ||
public class AnonymousStructWithRenameLongFieldNamesInner { | ||
public string some_long_field_name { get; set; } | ||
public bool and { get; set; } | ||
public IEnumerable<string> but_one_more { get; set; } | ||
} | ||
|
||
/** Generated type representing the anonymous struct variant `KebabCase` of the `AnonymousStructWithRename` Rust enum */ | ||
public class AnonymousStructWithRenameKebabCaseInner { | ||
public IEnumerable<string> another-list { get; set; } | ||
public string camelCaseStringField { get; set; } | ||
public bool something-else { get; set; } | ||
} | ||
|
||
[JsonConverter(typeof(JsonSubtypes), "type")] | ||
[JsonSubtypes.KnownSubType(typeof(List), "List")] | ||
[JsonSubtypes.KnownSubType(typeof(LongFieldNames), "LongFieldNames")] | ||
[JsonSubtypes.KnownSubType(typeof(KebabCase), "KebabCase")] | ||
public abstract record AnonymousStructWithRename | ||
{ | ||
public record list(AnonymousStructWithRenameListInner Content): AnonymousStructWithRename(); | ||
public record longFieldNames(AnonymousStructWithRenameLongFieldNamesInner Content): AnonymousStructWithRename(); | ||
public record kebabCase(AnonymousStructWithRenameKebabCaseInner Content): AnonymousStructWithRename(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
public class OtherType { | ||
} | ||
|
||
/** This is a comment. */ | ||
public class Person { | ||
public string name { get; set; } | ||
public ushort age { get; set; } | ||
public int extraSpecialFieldOne { get; set; } | ||
public IEnumerable<string>? extraSpecialFieldTwo { get; set; } | ||
public OtherType nonStandardDataType { get; set; } | ||
public IEnumerable<OtherType>? nonStandardDataTypeInArray { get; set; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
/** This is a Person struct with camelCase rename */ | ||
public class Person { | ||
public string firstName { get; set; } | ||
public string lastName { get; set; } | ||
public ushort age { get; set; } | ||
public int extraSpecialField1 { get; set; } | ||
public IEnumerable<string>? extraSpecialField2 { get; set; } | ||
} | ||
|
||
/** This is a Person2 struct with UPPERCASE rename */ | ||
public class Person2 { | ||
public string FIRST_NAME { get; set; } | ||
public string LAST_NAME { get; set; } | ||
public ushort AGE { get; set; } | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
core/data/tests/can_handle_serde_rename_on_top_level/output.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
public class OtherType { | ||
} | ||
|
||
/** This is a comment. */ | ||
public class PersonTwo { | ||
public string name { get; set; } | ||
public ushort age { get; set; } | ||
public int extraSpecialFieldOne { get; set; } | ||
public IEnumerable<string>? extraSpecialFieldTwo { get; set; } | ||
public OtherType nonStandardDataType { get; set; } | ||
public IEnumerable<OtherType>? nonStandardDataTypeInArray { get; set; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
public class OverrideStruct { | ||
public char fieldToOverride { get; set; } | ||
} | ||
|
||
/** Generated type representing the anonymous struct variant `AnonymousStructVariant` of the `OverrideEnum` Rust enum */ | ||
public class OverrideEnumAnonymousStructVariantInner { | ||
public char fieldToOverride { get; set; } | ||
} | ||
|
||
[JsonConverter(typeof(JsonSubtypes), "type")] | ||
[JsonSubtypes.KnownSubType(typeof(UnitVariant), "UnitVariant")] | ||
[JsonSubtypes.KnownSubType(typeof(TupleVariant), "TupleVariant")] | ||
[JsonSubtypes.KnownSubType(typeof(AnonymousStructVariant), "AnonymousStructVariant")] | ||
public abstract record OverrideEnum | ||
{ | ||
public record UnitVariant(): OverrideEnum(); | ||
public record TupleVariant(string Content) : OverrideEnum(); | ||
public record AnonymousStructVariant(OverrideEnumAnonymousStructVariantInner Content): OverrideEnum(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#nullable enable | ||
|
||
using System.Reflection; | ||
using JsonSubTypes; | ||
using Newtonsoft.Json; | ||
using System.Runtime.Serialization; | ||
|
||
/** This is a comment. */ | ||
public class Things { | ||
public string bla { get; set; } | ||
public string? label { get; set; } | ||
public string? label-left { get; set; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters