Skip to content

Commit

Permalink
Update C# snapshots with required attr
Browse files Browse the repository at this point in the history
  • Loading branch information
dandro committed Jun 30, 2024
1 parent 4ed61b3 commit 3b75a12
Show file tree
Hide file tree
Showing 24 changed files with 91 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/data/tests/anonymous_struct_with_rename/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,27 @@

/** Generated type representing the anonymous struct variant `List` of the `AnonymousStructWithRename` Rust enum */
public class AnonymousStructWithRenameListInner {
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> list { get; set; }
}

/** Generated type representing the anonymous struct variant `LongFieldNames` of the `AnonymousStructWithRename` Rust enum */
public class AnonymousStructWithRenameLongFieldNamesInner {
[JsonProperty(Required = Required.Always)]
public string some_long_field_name { get; set; }
[JsonProperty(Required = Required.Always)]
public bool and { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> but_one_more { get; set; }
}

/** Generated type representing the anonymous struct variant `KebabCase` of the `AnonymousStructWithRename` Rust enum */
public class AnonymousStructWithRenameKebabCaseInner {
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> another-list { get; set; }
[JsonProperty(Required = Required.Always)]
public string camelCaseStringField { get; set; }
[JsonProperty(Required = Required.Always)]
public bool something-else { get; set; }
}

Expand Down
1 change: 1 addition & 0 deletions core/data/tests/can_apply_prefix_correctly/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class ItemDetailsFieldValue {
[JsonProperty(Required = Required.Always)]
public string Hello { get; set; }
}

Expand Down
7 changes: 7 additions & 0 deletions core/data/tests/can_generate_generic_enum/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public record VariantB(TB Content) : GenericEnum<TA, TB>();


public class StructUsingGenericEnum {
[JsonProperty(Required = Required.Always)]
public GenericEnum<string, short> EnumField { get; set; }
}

Expand All @@ -33,23 +34,29 @@ public record VariantE(GenericEnum<string, uint> Content) : GenericEnumUsingGene

/** Generated type representing the anonymous struct variant `VariantF` of the `GenericEnumsUsingStructVariants` Rust enum */
public class GenericEnumsUsingStructVariantsVariantFInner<T> {
[JsonProperty(Required = Required.Always)]
public T Action { get; set; }
}

/** Generated type representing the anonymous struct variant `VariantG` of the `GenericEnumsUsingStructVariants` Rust enum */
public class GenericEnumsUsingStructVariantsVariantGInner<T, TU> {
[JsonProperty(Required = Required.Always)]
public T Action { get; set; }
[JsonProperty(Required = Required.Always)]
public TU Response { get; set; }
}

/** Generated type representing the anonymous struct variant `VariantH` of the `GenericEnumsUsingStructVariants` Rust enum */
public class GenericEnumsUsingStructVariantsVariantHInner {
[JsonProperty(Required = Required.Always)]
public int NonGeneric { get; set; }
}

/** Generated type representing the anonymous struct variant `VariantI` of the `GenericEnumsUsingStructVariants` Rust enum */
public class GenericEnumsUsingStructVariantsVariantIInner<T, TU> {
[JsonProperty(Required = Required.Always)]
public IEnumerable<T> Vec { get; set; }
[JsonProperty(Required = Required.Always)]
public MyType<T, TU> Action { get; set; }
}

Expand Down
1 change: 1 addition & 0 deletions core/data/tests/can_generate_readonly_fields/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class SomeStruct {
[JsonProperty(Required = Required.Always)]
public uint FieldA { get; set; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ public class Location {
/** This is a comment. */
public class Person {
/** This is another comment */
[JsonProperty(Required = Required.Always)]
public string Name { get; set; }
[JsonProperty(Required = Required.Always)]
public ushort Age { get; set; }
public string? Info { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Emails { get; set; }
[JsonProperty(Required = Required.Always)]
public Location Location { get; set; }
}

1 change: 1 addition & 0 deletions core/data/tests/can_generate_slice_of_user_type/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class Video {
[JsonProperty(Required = Required.Always)]
public IEnumerable<Tag> Tags { get; set; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using System.Runtime.Serialization;

public class MyStruct {
[JsonProperty(Required = Required.Always)]
public int A { get; set; }
[JsonProperty(Required = Required.Always)]
public int C { get; set; }
}

6 changes: 6 additions & 0 deletions core/data/tests/can_handle_anonymous_struct/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
/** Generated type representing the anonymous struct variant `Us` of the `AutofilledBy` Rust enum */
public class AutofilledByUsInner {
/** The UUID for the fill */
[JsonProperty(Required = Required.Always)]
public string Uuid { get; set; }
}

/** Generated type representing the anonymous struct variant `SomethingElse` of the `AutofilledBy` Rust enum */
public class AutofilledBySomethingElseInner {
/** The UUID for the fill */
[JsonProperty(Required = Required.Always)]
public string Uuid { get; set; }
/** Some other thing */
[JsonProperty(Required = Required.Always)]
public int Thing { get; set; }
}

Expand All @@ -34,12 +37,15 @@ public record SomethingElse(AutofilledBySomethingElseInner Content): AutofilledB

/** Generated type representing the anonymous struct variant `AnonVariant` of the `EnumWithManyVariants` Rust enum */
public class EnumWithManyVariantsAnonVariantInner {
[JsonProperty(Required = Required.Always)]
public string Uuid { get; set; }
}

/** Generated type representing the anonymous struct variant `AnotherAnonVariant` of the `EnumWithManyVariants` Rust enum */
public class EnumWithManyVariantsAnotherAnonVariantInner {
[JsonProperty(Required = Required.Always)]
public string Uuid { get; set; }
[JsonProperty(Required = Required.Always)]
public int Thing { get; set; }
}

Expand Down
4 changes: 4 additions & 0 deletions core/data/tests/can_handle_serde_rename/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ public class OtherType {

/** This is a comment. */
public class Person {
[JsonProperty(Required = Required.Always)]
public string name { get; set; }
[JsonProperty(Required = Required.Always)]
public ushort age { get; set; }
[JsonProperty(Required = Required.Always)]
public int extraSpecialFieldOne { get; set; }
public IEnumerable<string>? extraSpecialFieldTwo { get; set; }
[JsonProperty(Required = Required.Always)]
public OtherType nonStandardDataType { get; set; }
public IEnumerable<OtherType>? nonStandardDataTypeInArray { get; set; }
}
Expand Down
7 changes: 7 additions & 0 deletions core/data/tests/can_handle_serde_rename_all/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@

/** This is a Person struct with camelCase rename */
public class Person {
[JsonProperty(Required = Required.Always)]
public string firstName { get; set; }
[JsonProperty(Required = Required.Always)]
public string lastName { get; set; }
[JsonProperty(Required = Required.Always)]
public ushort age { get; set; }
[JsonProperty(Required = Required.Always)]
public int extraSpecialField1 { get; set; }
public IEnumerable<string>? extraSpecialField2 { get; set; }
}

/** This is a Person2 struct with UPPERCASE rename */
public class Person2 {
[JsonProperty(Required = Required.Always)]
public string FIRST_NAME { get; set; }
[JsonProperty(Required = Required.Always)]
public string LAST_NAME { get; set; }
[JsonProperty(Required = Required.Always)]
public ushort AGE { get; set; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ public class OtherType {

/** This is a comment. */
public class PersonTwo {
[JsonProperty(Required = Required.Always)]
public string name { get; set; }
[JsonProperty(Required = Required.Always)]
public ushort age { get; set; }
[JsonProperty(Required = Required.Always)]
public int extraSpecialFieldOne { get; set; }
public IEnumerable<string>? extraSpecialFieldTwo { get; set; }
[JsonProperty(Required = Required.Always)]
public OtherType nonStandardDataType { get; set; }
public IEnumerable<OtherType>? nonStandardDataTypeInArray { get; set; }
}
Expand Down
2 changes: 2 additions & 0 deletions core/data/tests/can_override_types/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Runtime.Serialization;

public class OverrideStruct {
[JsonProperty(Required = Required.Always)]
public char fieldToOverride { get; set; }
}

/** Generated type representing the anonymous struct variant `AnonymousStructVariant` of the `OverrideEnum` Rust enum */
public class OverrideEnumAnonymousStructVariantInner {
[JsonProperty(Required = Required.Always)]
public char fieldToOverride { get; set; }
}

Expand Down
4 changes: 4 additions & 0 deletions core/data/tests/can_recognize_types_inside_modules/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
using System.Runtime.Serialization;

public class A {
[JsonProperty(Required = Required.Always)]
public uint Field { get; set; }
}

public class ABC {
[JsonProperty(Required = Required.Always)]
public uint Field { get; set; }
}

public class AB {
[JsonProperty(Required = Required.Always)]
public uint Field { get; set; }
}

public class OutsideOfModules {
[JsonProperty(Required = Required.Always)]
public uint Field { get; set; }
}

9 changes: 9 additions & 0 deletions core/data/tests/generate_types/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ public class CustomType {
}

public class Types {
[JsonProperty(Required = Required.Always)]
public string S { get; set; }
[JsonProperty(Required = Required.Always)]
public string StaticS { get; set; }
[JsonProperty(Required = Required.Always)]
public short Int8 { get; set; }
[JsonProperty(Required = Required.Always)]
public float Float { get; set; }
[JsonProperty(Required = Required.Always)]
public double Double { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Array { get; set; }
[JsonProperty(Required = Required.Always)]
public string[] FixedLengthArray { get; set; }
[JsonProperty(Required = Required.Always)]
public IDictionary<string, int> Dictionary { get; set; }
public IDictionary<string, int>? OptionalDictionary { get; set; }
[JsonProperty(Required = Required.Always)]
public CustomType CustomType { get; set; }
}

1 change: 1 addition & 0 deletions core/data/tests/kebab_case_rename/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/** This is a comment. */
public class Things {
[JsonProperty(Required = Required.Always)]
public string bla { get; set; }
public string? label { get; set; }
public string? label-left { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions core/data/tests/recursive_enum_decorator/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ public record Vermont(Options Content) : Options();

/** Generated type representing the anonymous struct variant `Exactly` of the `MoreOptions` Rust enum */
public class MoreOptionsExactlyInner {
[JsonProperty(Required = Required.Always)]
public string Config { get; set; }
}

/** Generated type representing the anonymous struct variant `Built` of the `MoreOptions` Rust enum */
public class MoreOptionsBuiltInner {
[JsonProperty(Required = Required.Always)]
public MoreOptions Top { get; set; }
}

Expand Down
4 changes: 4 additions & 0 deletions core/data/tests/resolves_qualified_type/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
using System.Runtime.Serialization;

public class QualifiedTypes {
[JsonProperty(Required = Required.Always)]
public string Unqualified { get; set; }
[JsonProperty(Required = Required.Always)]
public string Qualified { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> QualifiedVec { get; set; }
[JsonProperty(Required = Required.Always)]
public IDictionary<string, string> QualifiedHashmap { get; set; }
public string? QualifiedOptional { get; set; }
public IDictionary<string, IEnumerable<string>>? QualfiedOptionalHashmapVec { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions core/data/tests/serialize_field_as/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using System.Runtime.Serialization;

public class EditItemViewModelSaveRequest {
[JsonProperty(Required = Required.Always)]
public string Context { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<EditItemSaveValue> Values { get; set; }
public AutoFillItemActionRequest? FillAction { get; set; }
}
Expand Down
12 changes: 12 additions & 0 deletions core/data/tests/smart_pointers/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,49 @@

/** This is a comment. */
public class ArcyColors {
[JsonProperty(Required = Required.Always)]
public ushort Red { get; set; }
[JsonProperty(Required = Required.Always)]
public string Blue { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Green { get; set; }
}

/** This is a comment. */
public class MutexyColors {
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Blue { get; set; }
[JsonProperty(Required = Required.Always)]
public string Green { get; set; }
}

/** This is a comment. */
public class RcyColors {
[JsonProperty(Required = Required.Always)]
public string Red { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Blue { get; set; }
[JsonProperty(Required = Required.Always)]
public string Green { get; set; }
}

/** This is a comment. */
public class CellyColors {
[JsonProperty(Required = Required.Always)]
public string Red { get; set; }
[JsonProperty(Required = Required.Always)]
public IEnumerable<string> Blue { get; set; }
}

/** This is a comment. */
public class LockyColors {
[JsonProperty(Required = Required.Always)]
public string Red { get; set; }
}

/** This is a comment. */
public class CowyColors {
[JsonProperty(Required = Required.Always)]
public string Lifetime { get; set; }
}

Expand Down
1 change: 1 addition & 0 deletions core/data/tests/test_generate_char/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class MyType {
[JsonProperty(Required = Required.Always)]
public char Field { get; set; }
}

2 changes: 2 additions & 0 deletions core/data/tests/test_i54_u53_type/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using System.Runtime.Serialization;

public class Foo {
[JsonProperty(Required = Required.Always)]
public long A { get; set; }
[JsonProperty(Required = Required.Always)]
public ulong B { get; set; }
}

1 change: 1 addition & 0 deletions core/data/tests/test_serde_iso8601/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class Foo {
[JsonProperty(Required = Required.Always)]
public string Time { get; set; }
}

1 change: 1 addition & 0 deletions core/data/tests/test_serde_url/output.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.Serialization;

public class Foo {
[JsonProperty(Required = Required.Always)]
public string Url { get; set; }
}

Loading

0 comments on commit 3b75a12

Please sign in to comment.