...
This commit is contained in:
parent
4be9cae9e6
commit
8dfc8fe9b8
@ -17,6 +17,7 @@ public class Test_10_SETTINGS_IMMUTABLE_CLASSES
|
||||
JsonClassGenerator jsonClassGenerator = new()
|
||||
{
|
||||
CodeWriter = new CSharpCodeWriter(),
|
||||
CollectionType = OutputCollectionType.IReadOnlyList,
|
||||
OutputType = OutputTypes.ImmutableClass,
|
||||
UseThisKeyWord = true,
|
||||
AttributeLibrary = JsonLibrary.NewtonsoftJson,
|
||||
|
@ -13,10 +13,10 @@
|
||||
}
|
||||
|
||||
[JsonProperty("SomeProps1")]
|
||||
public int SomeProps1 { get; }
|
||||
public int SomeProps1 { init; get; }
|
||||
|
||||
[JsonProperty("SomeProps2")]
|
||||
public string SomeProps2 { get; }
|
||||
public string SomeProps2 { init; get; }
|
||||
}
|
||||
|
||||
public class Class1
|
||||
@ -28,7 +28,7 @@
|
||||
[JsonProperty("awesomeobject")] Awesomeobject awesomeobject,
|
||||
[JsonProperty("created_at")] string createdAt,
|
||||
[JsonProperty("updated_at")] string updatedAt,
|
||||
[JsonProperty("users")] List<User> users
|
||||
[JsonProperty("users")] IReadOnlyList<User> users
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
@ -40,22 +40,22 @@
|
||||
}
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; }
|
||||
public int Id { init; get; }
|
||||
|
||||
[JsonProperty("user_id")]
|
||||
public string UserId { get; }
|
||||
public string UserId { init; get; }
|
||||
|
||||
[JsonProperty("awesomeobject")]
|
||||
public Awesomeobject Awesomeobject { get; }
|
||||
public Awesomeobject Awesomeobject { init; get; }
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public string CreatedAt { get; }
|
||||
public string CreatedAt { init; get; }
|
||||
|
||||
[JsonProperty("updated_at")]
|
||||
public string UpdatedAt { get; }
|
||||
public string UpdatedAt { init; get; }
|
||||
|
||||
[JsonProperty("users")]
|
||||
public IReadOnlyList<User> Users { get; }
|
||||
public IReadOnlyList<User> Users { init; get; }
|
||||
}
|
||||
|
||||
public class Class2
|
||||
@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
[JsonProperty("SomePropertyOfClass2")]
|
||||
public string SomePropertyOfClass2 { get; }
|
||||
public string SomePropertyOfClass2 { init; get; }
|
||||
}
|
||||
|
||||
public class Root
|
||||
@ -85,10 +85,10 @@
|
||||
}
|
||||
|
||||
[JsonProperty("Class1")]
|
||||
public Class1 Class1 { get; }
|
||||
public Class1 Class1 { init; get; }
|
||||
|
||||
[JsonProperty("Class2")]
|
||||
public Class2 Class2 { get; }
|
||||
public Class2 Class2 { init; get; }
|
||||
}
|
||||
|
||||
|
||||
@ -114,21 +114,21 @@
|
||||
}
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; }
|
||||
public string Id { init; get; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; }
|
||||
public string Name { init; get; }
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public string CreatedAt { get; }
|
||||
public string CreatedAt { init; get; }
|
||||
|
||||
[JsonProperty("updated_at")]
|
||||
public string UpdatedAt { get; }
|
||||
public string UpdatedAt { init; get; }
|
||||
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; }
|
||||
public string Email { init; get; }
|
||||
|
||||
[JsonProperty("testanadditionalfield")]
|
||||
public string Testanadditionalfield { get; }
|
||||
public string Testanadditionalfield { init; get; }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user