diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/CodeCompiler.cs b/src/NJsonSchema.CodeGeneration.CSharp.Tests/CodeCompiler.cs
index 1db1d3901..2b8a1f3b1 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/CodeCompiler.cs
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/CodeCompiler.cs
@@ -5,9 +5,9 @@ namespace NJsonSchema.CodeGeneration.CSharp.Tests;
public class CodeCompiler
{
- public static void AssertCompile(string source)
+ public static void AssertCompile(string source, CSharpParseOptions options = null)
{
- var syntaxTree = CSharpSyntaxTree.ParseText(source);
+ var syntaxTree = CSharpSyntaxTree.ParseText(source, options);
var metadataReferences = AppDomain.CurrentDomain.GetAssemblies()
.Where(x => !x.IsDynamic && !string.IsNullOrWhiteSpace(x.Location))
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/GeneralGeneratorTests.cs b/src/NJsonSchema.CodeGeneration.CSharp.Tests/GeneralGeneratorTests.cs
index 9367df001..df3b862ad 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/GeneralGeneratorTests.cs
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/GeneralGeneratorTests.cs
@@ -1695,6 +1695,50 @@ public async Task When_native_record_no_setter_in_class_and_constructor_provided
CodeCompiler.AssertCompile(output);
}
+#if NETCOREAPP3_1_OR_GREATER || NET5_0_OR_GREATER
+ [Fact]
+ public async Task When_csharp_record_no_setter_in_record_and_constructor_provided()
+ {
+ // Arrange
+ var schema = JsonSchema.FromType
();
+ var data = schema.ToJson();
+ var generator = new CSharpGenerator(schema, new CSharpGeneratorSettings
+ {
+ ClassStyle = CSharpClassStyle.Record,
+ GenerateNativeRecords = true,
+ SortConstructorParameters = false
+ });
+
+ // Act
+ var output = generator.GenerateFile("Address");
+
+ // Assert
+ await VerifyHelper.Verify(output);
+ CodeCompiler.AssertCompile(output, new Microsoft.CodeAnalysis.CSharp.CSharpParseOptions(Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp9));
+ }
+
+ [Fact]
+ public async Task When_csharp_record_init_in_record_and_constructor_provided()
+ {
+ // Arrange
+ var schema = JsonSchema.FromType();
+ var data = schema.ToJson();
+ var generator = new CSharpGenerator(schema, new CSharpGeneratorSettings
+ {
+ ClassStyle = CSharpClassStyle.Record,
+ SortConstructorParameters = false,
+ GenerateNativeRecords = true,
+ });
+
+ // Act
+ var output = generator.GenerateFile("Address");
+
+ // Assert
+ await VerifyHelper.Verify(output);
+ CodeCompiler.AssertCompile(output, new Microsoft.CodeAnalysis.CSharp.CSharpParseOptions(Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp9));
+ }
+#endif
+
public abstract class AbstractAddress
{
[JsonProperty("city")]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/InheritanceTests.cs b/src/NJsonSchema.CodeGeneration.CSharp.Tests/InheritanceTests.cs
index 659f57eec..a4f2afada 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/InheritanceTests.cs
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/InheritanceTests.cs
@@ -173,6 +173,28 @@ public async Task When_definitions_inherit_from_root_schema_and_STJ_polymorphism
CodeCompiler.AssertCompile(code);
}
+ [Fact]
+ public async Task When_definition_inherits_parameters_from_base_come_first()
+ {
+ // Arrange
+ var path = GetTestDirectory() + "/References/Car.json";
+
+ // Act
+ var schema = await JsonSchema.FromFileAsync(path);
+ var generator = new CSharpGenerator(schema, new CSharpGeneratorSettings
+ {
+ ClassStyle = CSharpClassStyle.Record,
+ SortConstructorParameters = false,
+ });
+
+ // Act
+ var code = generator.GenerateFile();
+
+ // Assert
+ await VerifyHelper.Verify(code);
+ CodeCompiler.AssertCompile(code);
+ }
+
private string GetTestDirectory()
{
#pragma warning disable SYSLIB0012
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Car.json b/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Car.json
new file mode 100644
index 000000000..a06b9e8a4
--- /dev/null
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Car.json
@@ -0,0 +1,16 @@
+{
+ "title": "Car",
+ "type": "object",
+ "description": "This is a car",
+ "allOf": [
+ {
+ "$ref": "Vehicle.json"
+ }
+ ],
+ "properties": {
+ "wheels": {
+ "type": "integer",
+ "description": "The number of wheels on the car"
+ }
+ }
+}
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Vehicle.json b/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Vehicle.json
new file mode 100644
index 000000000..2ad6ef0f8
--- /dev/null
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/References/Vehicle.json
@@ -0,0 +1,12 @@
+{
+ "title": "Vehicle",
+ "type": "object",
+ "x-abstract": true,
+ "description": "This is a vehicle",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "This is the ID of Vehicle"
+ }
+ }
+}
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AbstractSchemaTests.When_class_is_abstract_then_is_abstract_CSharp_keyword_is_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AbstractSchemaTests.When_class_is_abstract_then_is_abstract_CSharp_keyword_is_generated.verified.txt
index 95f66bdfa..00b624944 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AbstractSchemaTests.When_class_is_abstract_then_is_abstract_CSharp_keyword_is_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AbstractSchemaTests.When_class_is_abstract_then_is_abstract_CSharp_keyword_is_generated.verified.txt
@@ -10,9 +10,9 @@ namespace MyNamespace
public abstract partial class AbstractClass
{
+
[Newtonsoft.Json.JsonProperty("Foo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Foo { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_any_page_has_additional_properties.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_any_page_has_additional_properties.verified.txt
index 9188525c5..825702455 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_any_page_has_additional_properties.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_any_page_has_additional_properties.verified.txt
@@ -11,7 +11,6 @@ namespace ns
public partial class Page
{
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -25,14 +24,13 @@ namespace ns
public partial class Library
{
+
[Newtonsoft.Json.JsonProperty("Index", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary Index { get; set; }
[Newtonsoft.Json.JsonProperty("Page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public Page Page { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_dictionary_and_no_object_are_not_same.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_dictionary_and_no_object_are_not_same.verified.txt
index 666d19428..2137608ab 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_dictionary_and_no_object_are_not_same.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_AlwaysAllowAdditionalObjectProperties_is_set_then_dictionary_and_no_object_are_not_same.verified.txt
@@ -10,14 +10,13 @@ namespace ns
public partial class Library
{
+
[Newtonsoft.Json.JsonProperty("Index", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary Index { get; set; }
[Newtonsoft.Json.JsonProperty("Page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public object Page { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
index 5e0b89970..26a954e7d 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class Person
{
+
[Newtonsoft.Json.JsonProperty("Pet", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public Pet Pet { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -28,14 +27,13 @@ namespace MyNamespace
public partial class Pet
{
+
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
[Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
index 44e01da15..000e19ed5 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered.verified.txt
@@ -14,8 +14,6 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("Pet")]
public Pet Pet { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
@@ -33,12 +31,9 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long Id { get; set; }
-
[System.Text.Json.Serialization.JsonPropertyName("category")]
public string Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_base_class.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_base_class.verified.txt
index 7c83f3c6d..20e6660d4 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_base_class.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_base_class.verified.txt
@@ -14,12 +14,9 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("dog")]
public Dog Dog { get; set; }
-
[System.Text.Json.Serialization.JsonPropertyName("cat")]
public Cat Cat { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
@@ -50,12 +47,9 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long Id { get; set; }
-
[System.Text.Json.Serialization.JsonPropertyName("category")]
public string Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_lowest_base_class.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_lowest_base_class.verified.txt
index 58d983672..5e5753a58 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_lowest_base_class.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AdditionalPropertiesTests.When_using_SystemTextJson_additionalProperties_schema_is_set_for_object_then_special_property_is_rendered_only_for_lowest_base_class.verified.txt
@@ -14,7 +14,6 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("whiskers")]
public string Whiskers { get; set; }
-
}
public partial class Pet : Animal
@@ -23,7 +22,6 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long Id { get; set; }
-
}
public partial class Animal
@@ -32,8 +30,6 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("category")]
public string Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
@@ -51,8 +47,6 @@ namespace MyNamespace
[System.Text.Json.Serialization.JsonPropertyName("Name")]
public string Name { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[System.Text.Json.Serialization.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_one_schema_then_it_is_inherited.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_one_schema_then_it_is_inherited.verified.txt
index 15d4e0479..9c9121c89 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_one_schema_then_it_is_inherited.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_one_schema_then_it_is_inherited.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class B
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Foo { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -29,6 +28,7 @@ namespace MyNamespace
[Newtonsoft.Json.JsonConverter(typeof(JsonInheritanceConverter), "type")]
public partial class A : B
{
+
[Newtonsoft.Json.JsonProperty("prop", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
[System.ComponentModel.DataAnnotations.StringLength(30, MinimumLength = 1)]
@@ -37,7 +37,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("prop2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop2 { get; set; }
-
}
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple = true)]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_two_schemas_then_referenced_schema_is_inherited.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_two_schemas_then_referenced_schema_is_inherited.verified.txt
index 2c7b93557..e8b1851f5 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_two_schemas_then_referenced_schema_is_inherited.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_has_two_schemas_then_referenced_schema_is_inherited.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class B
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Foo { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -28,6 +27,7 @@ namespace MyNamespace
public partial class A : B
{
+
[Newtonsoft.Json.JsonProperty("prop", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
[System.ComponentModel.DataAnnotations.StringLength(30, MinimumLength = 1)]
@@ -36,6 +36,5 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("prop2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop2 { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_contains_two_anonymous_nodes_without_type_specifier_an_anonymous_class_is_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_contains_two_anonymous_nodes_without_type_specifier_an_anonymous_class_is_generated.verified.txt
index a29044d30..33a95e51a 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_contains_two_anonymous_nodes_without_type_specifier_an_anonymous_class_is_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_contains_two_anonymous_nodes_without_type_specifier_an_anonymous_class_is_generated.verified.txt
@@ -10,19 +10,18 @@ namespace MyNamespace
public partial class Foo : Anonymous
{
+
[Newtonsoft.Json.JsonProperty("prop2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double Prop2 { get; set; }
-
}
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("prop1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_is_object_type_then_it_is_an_inherited_class_in_generated_code.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_is_object_type_then_it_is_an_inherited_class_in_generated_code.verified.txt
index 7bb6bf33c..2fc52bb26 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_is_object_type_then_it_is_an_inherited_class_in_generated_code.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_allOf_schema_is_object_type_then_it_is_an_inherited_class_in_generated_code.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class Bar
{
+
[Newtonsoft.Json.JsonProperty("prop2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop2 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -28,9 +27,9 @@ namespace MyNamespace
public partial class Foo : Bar
{
+
[Newtonsoft.Json.JsonProperty("prop1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop1 { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_all_of_has_multiple_refs_then_the_properties_should_expand_to_single_class.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_all_of_has_multiple_refs_then_the_properties_should_expand_to_single_class.verified.txt
index 004a03c0d..e26fe1bb6 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_all_of_has_multiple_refs_then_the_properties_should_expand_to_single_class.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_all_of_has_multiple_refs_then_the_properties_should_expand_to_single_class.verified.txt
@@ -10,11 +10,10 @@ namespace ns
public partial class TRef1
{
+
[Newtonsoft.Json.JsonProperty("val1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Val1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -28,11 +27,10 @@ namespace ns
public partial class TRef2
{
+
[Newtonsoft.Json.JsonProperty("val2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Val2 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -46,11 +44,10 @@ namespace ns
public partial class TRef3
{
+
[Newtonsoft.Json.JsonProperty("val3", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Val3 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -64,20 +61,20 @@ namespace ns
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("tAgg", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public TAgg TAgg { get; set; }
-
}
public partial class TAgg : TRef1
{
+
[Newtonsoft.Json.JsonProperty("val2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Val2 { get; set; }
[Newtonsoft.Json.JsonProperty("val3", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Val3 { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_more_properties_are_defined_in_allOf_and_type_none_then_all_of_contains_all_properties_in_generated_code.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_more_properties_are_defined_in_allOf_and_type_none_then_all_of_contains_all_properties_in_generated_code.verified.txt
index 0dd9b57d6..889e21056 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_more_properties_are_defined_in_allOf_and_type_none_then_all_of_contains_all_properties_in_generated_code.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AllOfTests.When_more_properties_are_defined_in_allOf_and_type_none_then_all_of_contains_all_properties_in_generated_code.verified.txt
@@ -10,22 +10,21 @@ namespace MyNamespace
public partial class Foo : Anonymous
{
+
[Newtonsoft.Json.JsonProperty("prop1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop1 { get; set; }
[Newtonsoft.Json.JsonProperty("prop2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Prop2 { get; set; }
-
}
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("baseProperty", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string BaseProperty { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AnnotationsTests.When_array_property_is_not_nullable_then_it_does_not_have_a_setter.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AnnotationsTests.When_array_property_is_not_nullable_then_it_does_not_have_a_setter.verified.txt
index 6c7e1376c..2e446d7e2 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AnnotationsTests.When_array_property_is_not_nullable_then_it_does_not_have_a_setter.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/AnnotationsTests.When_array_property_is_not_nullable_then_it_does_not_have_a_setter.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class MyRequiredTest
{
+
[Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Name { get; set; }
@@ -21,6 +22,5 @@ namespace MyNamespace
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.IDictionary Dictionary { get; } = new System.Collections.Generic.Dictionary();
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_item_is_nullable_then_generated_CSharp_is_correct.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_item_is_nullable_then_generated_CSharp_is_correct.verified.txt
index 53ae93fb1..11f4fccf2 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_item_is_nullable_then_generated_CSharp_is_correct.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_item_is_nullable_then_generated_CSharp_is_correct.verified.txt
@@ -10,9 +10,9 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("Items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection Items { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_property_is_required_then_array_instance_can_be_changed.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_property_is_required_then_array_instance_can_be_changed.verified.txt
index 2f36d974e..bc9ed0f99 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_property_is_required_then_array_instance_can_be_changed.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/ArrayTests.When_array_property_is_required_then_array_instance_can_be_changed.verified.txt
@@ -10,10 +10,10 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("ArrayProperty", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public Foo ArrayProperty { get; set; } = new Bar();
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_generates_expected_expression.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_generates_expected_expression.verified.txt
index e7f580ada..3f7269159 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_generates_expected_expression.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_generates_expected_expression.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("someOptionalProperty", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double SomeOptionalProperty { get; set; } = 123D;
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_array_of_arrays_generates_expected_expression.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_array_of_arrays_generates_expected_expression.verified.txt
index 77886d84b..6d0d0eef0 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_array_of_arrays_generates_expected_expression.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_array_of_arrays_generates_expected_expression.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("requiredList", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection> RequiredList { get; set; } = new System.Collections.ObjectModel.Collection>();
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_dictionary_with_array_values_generates_expected_expression.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_dictionary_with_array_values_generates_expected_expression.verified.txt
index 0aeb3763c..d4b0e5cfd 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_dictionary_with_array_values_generates_expected_expression.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_of_dictionary_with_array_values_generates_expected_expression.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("requiredDictionary", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.IDictionary> RequiredDictionary { get; set; } = new System.Collections.Generic.Dictionary>();
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_with_decimal_generates_expected_expression.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_with_decimal_generates_expected_expression.verified.txt
index a3a20e1c8..43f4a16ec 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_with_decimal_generates_expected_expression.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_generating_CSharp_code_then_default_value_with_decimal_generates_expected_expression.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class Anonymous
{
+
[Newtonsoft.Json.JsonProperty("someOptionalProperty", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double SomeOptionalProperty { get; set; } = 123.456D;
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_and_default_value_generation_is_disabled_then_default_value_is_not_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_and_default_value_generation_is_disabled_then_default_value_is_not_generated.verified.txt
index d10ddbdab..7f7fb274f 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_and_default_value_generation_is_disabled_then_default_value_is_not_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_and_default_value_generation_is_disabled_then_default_value_is_not_generated.verified.txt
@@ -10,11 +10,10 @@ namespace ns
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("boolWithDefault", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool BoolWithDefault { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_it_is_reflected_in_the_poco.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_it_is_reflected_in_the_poco.verified.txt
index 1b090a90b..106b9cf0a 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_it_is_reflected_in_the_poco.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_boolean_default_it_is_reflected_in_the_poco.verified.txt
@@ -10,11 +10,10 @@ namespace ns
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("boolWithDefault", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool BoolWithDefault { get; set; } = false;
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_interger_default_it_is_reflected_in_the_poco.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_interger_default_it_is_reflected_in_the_poco.verified.txt
index 2a8243c88..44f19396a 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_interger_default_it_is_reflected_in_the_poco.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DefaultPropertyTests.When_property_has_interger_default_it_is_reflected_in_the_poco.verified.txt
@@ -10,11 +10,10 @@ namespace ns
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("intergerWithDefault", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int IntergerWithDefault { get; set; } = 5;
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_key_is_enum_then_csharp_has_enum_key.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_key_is_enum_then_csharp_has_enum_key.verified.txt
index bb660fc8a..98c5f1a43 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_key_is_enum_then_csharp_has_enum_key.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_key_is_enum_then_csharp_has_enum_key.verified.txt
@@ -21,6 +21,7 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("EnumDictionary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary EnumDictionary { get; set; }
@@ -28,6 +29,5 @@ namespace MyNamespace
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.IDictionary EnumInterfaceDictionary { get; set; } = new System.Collections.Generic.Dictionary();
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_property_is_required_then_dictionary_instance_can_be_changed.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_property_is_required_then_dictionary_instance_can_be_changed.verified.txt
index d4e01bacd..d437d46d1 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_property_is_required_then_dictionary_instance_can_be_changed.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/DictionaryTests.When_dictionary_property_is_required_then_dictionary_instance_can_be_changed.verified.txt
@@ -21,6 +21,7 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("EnumDictionary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public Foo EnumDictionary { get; set; }
@@ -28,6 +29,5 @@ namespace MyNamespace
[System.ComponentModel.DataAnnotations.Required]
public Foo EnumInterfaceDictionary { get; set; } = new Bar();
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_array_item_enum_is_not_referenced_then_type_name_hint_is_property_name.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_array_item_enum_is_not_referenced_then_type_name_hint_is_property_name.verified.txt
index 10a17051b..422bab3ac 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_array_item_enum_is_not_referenced_then_type_name_hint_is_property_name.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_array_item_enum_is_not_referenced_then_type_name_hint_is_property_name.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class NewOrderModel
{
+
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get; set; }
@@ -19,8 +20,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ItemConverterType = typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public System.Collections.Generic.ICollection Status { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -34,11 +33,10 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public NewOrderModel Foo1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_class_has_enum_array_property_then_enum_name_is_preserved.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_class_has_enum_array_property_then_enum_name_is_preserved.verified.txt
index d85caaaaf..f4ba486b1 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_class_has_enum_array_property_then_enum_name_is_preserved.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_class_has_enum_array_property_then_enum_name_is_preserved.verified.txt
@@ -21,12 +21,12 @@ namespace MyNamespace
public partial class SomeClass
{
+
[Newtonsoft.Json.JsonProperty("SomeProperty", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int SomeProperty { get; set; }
[Newtonsoft.Json.JsonProperty("SomeEnums", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection SomeEnums { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_contains_operator_convert_to_string_equivalent.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_contains_operator_convert_to_string_equivalent.verified.txt
index 3c598780f..bdef5efb4 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_contains_operator_convert_to_string_equivalent.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_contains_operator_convert_to_string_equivalent.verified.txt
@@ -62,12 +62,11 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public OperatorTestEnum? Foo1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_a_format_then_enum_is_generated_with_correct_basetype.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_a_format_then_enum_is_generated_with_correct_basetype.verified.txt
index 7ed919fca..8ff4ef62c 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_a_format_then_enum_is_generated_with_correct_basetype.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_a_format_then_enum_is_generated_with_correct_basetype.verified.txt
@@ -21,11 +21,10 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public ManyValuesTestEnum Foo { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated.verified.txt
index 0afadaacc..a17bd6b19 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MyClassCategory Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated_with_flags.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated_with_flags.verified.txt
index 98868ea95..e59ae5060 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated_with_flags.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_has_no_type_then_enum_is_generated_with_flags.verified.txt
@@ -10,11 +10,10 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MyClassCategory Category { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_integer_flags_it_should_use_declared_values.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_integer_flags_it_should_use_declared_values.verified.txt
index baef5d3e7..dd437aebf 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_integer_flags_it_should_use_declared_values.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_integer_flags_it_should_use_declared_values.verified.txt
@@ -34,11 +34,10 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public FlagsTestEnum Foo1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_and_has_default_then_question_mark_is_omitted.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_and_has_default_then_question_mark_is_omitted.verified.txt
index c2c806218..44a59074c 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_and_has_default_then_question_mark_is_omitted.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_and_has_default_then_question_mark_is_omitted.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public MyClassCategory? Category { get; set; } = MyNamespace.MyClassCategory.Commercial;
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_not_required_it_should_be_nullable_with_converter.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_not_required_it_should_be_nullable_with_converter.verified.txt
index 67af2f94b..b7d3bf8b2 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_not_required_it_should_be_nullable_with_converter.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_not_required_it_should_be_nullable_with_converter.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("myProperty", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public FooMyProperty? MyProperty { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_required_it_should_be_nullable_with_converter.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_required_it_should_be_nullable_with_converter.verified.txt
index caecf8702..0b38fb856 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_required_it_should_be_nullable_with_converter.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_required_it_should_be_nullable_with_converter.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("myProperty", Required = Newtonsoft.Json.Required.AllowNull)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public FooMyProperty? MyProperty { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_then_StringEnumConverter_is_set.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_then_StringEnumConverter_is_set.verified.txt
index d42e9dbe1..595644730 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_then_StringEnumConverter_is_set.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_is_nullable_then_StringEnumConverter_is_set.verified.txt
@@ -23,6 +23,7 @@ namespace MyNamespace
public partial class MyStringEnumListTest
{
+
[Newtonsoft.Json.JsonProperty("Enums", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ItemConverterType = typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public System.Collections.Generic.ICollection Enums { get; set; }
@@ -30,6 +31,5 @@ namespace MyNamespace
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public MyStringEnum? NullableEnum { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_list_uses_string_enums_then_ItemConverterType_is_set.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_list_uses_string_enums_then_ItemConverterType_is_set.verified.txt
index d42e9dbe1..595644730 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_list_uses_string_enums_then_ItemConverterType_is_set.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_list_uses_string_enums_then_ItemConverterType_is_set.verified.txt
@@ -23,6 +23,7 @@ namespace MyNamespace
public partial class MyStringEnumListTest
{
+
[Newtonsoft.Json.JsonProperty("Enums", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ItemConverterType = typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public System.Collections.Generic.ICollection Enums { get; set; }
@@ -30,6 +31,5 @@ namespace MyNamespace
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public MyStringEnum? NullableEnum { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_name_contains_colon_then_it_is_removed_and_next_word_converted_to_upper_case.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_name_contains_colon_then_it_is_removed_and_next_word_converted_to_upper_case.verified.txt
index 5ddda26f9..d9467036e 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_name_contains_colon_then_it_is_removed_and_next_word_converted_to_upper_case.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_name_contains_colon_then_it_is_removed_and_next_word_converted_to_upper_case.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class MyClass
{
+
///
/// The event identifier.
///
@@ -17,8 +18,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public MyClassEvent Event { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_property_is_not_required_in_Swagger2_then_it_is_nullable.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_property_is_not_required_in_Swagger2_then_it_is_nullable.verified.txt
index 7d707cfc1..a28e85094 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_property_is_not_required_in_Swagger2_then_it_is_nullable.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_property_is_not_required_in_Swagger2_then_it_is_nullable.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class MyClass
{
+
///
/// pet status in the store
///
@@ -17,8 +18,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public MyClassStatus? Status { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_starts_with_plus_or_minus_convert_to_string_equivalent.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_starts_with_plus_or_minus_convert_to_string_equivalent.verified.txt
index e597db407..146b9f932 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_starts_with_plus_or_minus_convert_to_string_equivalent.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_enum_starts_with_plus_or_minus_convert_to_string_equivalent.verified.txt
@@ -26,12 +26,11 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public PlusMinusTestEnum Foo1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_type_name_hint_has_generics_then_they_are_converted.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_type_name_hint_has_generics_then_they_are_converted.verified.txt
index 405f9cc74..82d9c6359 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_type_name_hint_has_generics_then_they_are_converted.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/EnumTests.When_type_name_hint_has_generics_then_they_are_converted.verified.txt
@@ -10,12 +10,11 @@ namespace MyNamespace
public partial class FirstMetdodOfMetValue
{
+
[Newtonsoft.Json.JsonProperty("GroupChar", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public FirstMetdodOfMetValueGroupChar GroupChar { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
@@ -29,11 +28,10 @@ namespace MyNamespace
public partial class Foo
{
+
[Newtonsoft.Json.JsonProperty("foo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public FirstMetdodOfMetValue Foo1 { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_base64_format.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_base64_format.verified.txt
index 5b887669f..57e9a35a1 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_base64_format.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_base64_format.verified.txt
@@ -10,9 +10,9 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("Content", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public byte[] Content { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_byte_format.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_byte_format.verified.txt
index 5b887669f..57e9a35a1 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_byte_format.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.Can_generate_type_from_string_property_with_byte_format.verified.txt
@@ -10,9 +10,9 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("Content", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public byte[] Content { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_POCO_is_set_then_auto_properties_are_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_POCO_is_set_then_auto_properties_are_generated.verified.txt
index 80811bd0d..a81a77532 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_POCO_is_set_then_auto_properties_are_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_POCO_is_set_then_auto_properties_are_generated.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class Person
{
+
[Newtonsoft.Json.JsonProperty("FirstName", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public string FirstName { get; set; }
@@ -44,7 +45,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("Dictionary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary Dictionary { get; set; }
-
}
public enum Gender
@@ -60,20 +60,20 @@ namespace MyNamespace
public partial class Address
{
+
[Newtonsoft.Json.JsonProperty("Street", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Street { get; set; }
[Newtonsoft.Json.JsonProperty("City", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; set; }
-
}
public partial class MyClass : Person
{
+
[Newtonsoft.Json.JsonProperty("Class", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Class { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_allOf_contains_one_schema_then_csharp_inheritance_is_generated.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_allOf_contains_one_schema_then_csharp_inheritance_is_generated.verified.txt
index cb3f1f3d8..00ec0025a 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_allOf_contains_one_schema_then_csharp_inheritance_is_generated.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_allOf_contains_one_schema_then_csharp_inheritance_is_generated.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class Person
{
+
[Newtonsoft.Json.JsonProperty("FirstName", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public string FirstName { get; set; }
@@ -44,7 +45,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("Dictionary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary Dictionary { get; set; }
-
}
public enum Gender
@@ -60,20 +60,20 @@ namespace MyNamespace
public partial class Address
{
+
[Newtonsoft.Json.JsonProperty("Street", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Street { get; set; }
[Newtonsoft.Json.JsonProperty("City", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; set; }
-
}
public partial class Teacher : Person
{
+
[Newtonsoft.Json.JsonProperty("Class", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Class { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_array_property_is_required_or_not_then_the_code_has_correct_initializer.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_array_property_is_required_or_not_then_the_code_has_correct_initializer.verified.txt
index 135745502..830ba9f66 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_array_property_is_required_or_not_then_the_code_has_correct_initializer.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_array_property_is_required_or_not_then_the_code_has_correct_initializer.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("A", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection A { get; set; } = new System.Collections.ObjectModel.Collection();
@@ -17,8 +18,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("B", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection B { get; set; }
-
-
private System.Collections.Generic.IDictionary _additionalProperties;
[Newtonsoft.Json.JsonExtensionData]
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_has_description_then_csharp_has_xml_comment.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_has_description_then_csharp_has_xml_comment.verified.txt
index 92ecedf27..b1e568fb5 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_has_description_then_csharp_has_xml_comment.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_has_description_then_csharp_has_xml_comment.verified.txt
@@ -10,6 +10,7 @@ namespace MyNamespace
public partial class Person
{
+
[Newtonsoft.Json.JsonProperty("FirstName", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public string FirstName { get; set; }
@@ -44,7 +45,6 @@ namespace MyNamespace
[Newtonsoft.Json.JsonProperty("Dictionary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary Dictionary { get; set; }
-
}
public enum Gender
@@ -60,13 +60,13 @@ namespace MyNamespace
public partial class Address
{
+
[Newtonsoft.Json.JsonProperty("Street", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Street { get; set; }
[Newtonsoft.Json.JsonProperty("City", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; set; }
-
}
///
@@ -74,9 +74,9 @@ namespace MyNamespace
///
public partial class MyClass : Person
{
+
[Newtonsoft.Json.JsonProperty("Class", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Class { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_is_abstract_constructor_is_protected_for_record.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_is_abstract_constructor_is_protected_for_record.verified.txt
index 4a490aa6b..51f83ac2d 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_is_abstract_constructor_is_protected_for_record.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_class_is_abstract_constructor_is_protected_for_record.verified.txt
@@ -11,22 +11,17 @@ namespace MyNamespace
public abstract partial class AbstractAddress
{
[Newtonsoft.Json.JsonConstructor]
-
protected AbstractAddress(string @city, string @streetName)
-
-
{
-
this.City = @city;
-
this.StreetName = @streetName;
+ }
- } [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; }
[Newtonsoft.Json.JsonProperty("streetName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string StreetName { get; }
-
}
}
\ No newline at end of file
diff --git a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_code_is_generated_then_toolchain_version_is_printed.verified.txt b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_code_is_generated_then_toolchain_version_is_printed.verified.txt
index 608839832..ac5447e29 100644
--- a/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_code_is_generated_then_toolchain_version_is_printed.verified.txt
+++ b/src/NJsonSchema.CodeGeneration.CSharp.Tests/Snapshots/GeneralGeneratorTests.When_code_is_generated_then_toolchain_version_is_printed.verified.txt
@@ -10,12 +10,11 @@ namespace ns
public partial class MyClass
{
+
[Newtonsoft.Json.JsonProperty("emptySchema", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection