diff --git a/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs b/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs index c2bc71b3ea1..8721c560163 100644 --- a/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs +++ b/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs @@ -182,7 +182,7 @@ private void ParseFieldProperty(ElementMetadata element, StringBuilder classBuil else { elementOrder += 1; - classBuilder.AppendLine(Indent(2) + "[XmlElement(\"" + element.XName + "\", Order = " + elementOrder + ")]"); + AddXmlElementAnnotation(element, classBuilder, elementOrder); // Temporary fix - as long as we use System.Text.Json for serialization and Newtonsoft.Json for // deserialization, we need both JsonProperty and JsonPropertyName annotations. @@ -223,7 +223,7 @@ private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuil var nullableReference = useNullableReferenceTypes ? "?" : string.Empty; WriteRestrictionAnnotations(classBuilder, element); elementOrder += 1; - classBuilder.AppendLine(Indent(2) + "[XmlElement(\"" + element.XName + "\", Order = " + elementOrder + ")]"); + AddXmlElementAnnotation(element, classBuilder, elementOrder); // Temporary fix - as long as we use System.Text.Json for serialization and Newtonsoft.Json for // deserialization, we need both JsonProperty and JsonPropertyName annotations. @@ -265,6 +265,18 @@ private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuil } } + private void AddXmlElementAnnotation(ElementMetadata element, StringBuilder classBuilder, int elementOrder) + { + if (element.OrderOblivious) + { + classBuilder.AppendLine($"""{Indent(2)}[XmlElement("{element.XName}")]"""); + } + else + { + classBuilder.AppendLine($"""{Indent(2)}[XmlElement("{element.XName}", Order = {elementOrder})]"""); + } + } + private void AddShouldSerializeForTagContent(ElementMetadata element, StringBuilder classBuilder, ModelMetadata modelMetadata) { var children = modelMetadata.Elements.Values.Where(metadata => diff --git a/backend/src/DataModeling/Converter/Metadata/JsonSchemaToMetamodelConverter.cs b/backend/src/DataModeling/Converter/Metadata/JsonSchemaToMetamodelConverter.cs index 4473410cb3c..29907340633 100644 --- a/backend/src/DataModeling/Converter/Metadata/JsonSchemaToMetamodelConverter.cs +++ b/backend/src/DataModeling/Converter/Metadata/JsonSchemaToMetamodelConverter.cs @@ -36,6 +36,9 @@ private sealed class SchemaContext public bool XmlText { get; set; } + + public bool OrderOblivious { get; set; } = false; + public Dictionary Restrictions { get; set; } = new(); } @@ -185,6 +188,10 @@ private void ProcessKeyword(JsonPointer path, IJsonSchemaKeyword keyword, Schema ProcessPropertiesKeyword(path, k, context); break; + case XsdStructureKeyword { Value: "all" }: + context.OrderOblivious = true; + break; + default: throw new MetamodelConvertException($"Keyword {keyword.Keyword()} not processed!. It's not supported in the current version of the JsonSchemaToMetamodelConverter."); } @@ -267,7 +274,7 @@ private void ProcessPropertiesKeyword(JsonPointer path, PropertiesKeyword keywor { foreach (var (name, property) in keyword.Properties) { - var currentContext = new SchemaContext() { Id = CombineId(context.Id, name), Name = name, ParentId = context.Id, XPath = CombineXPath(context.XPath, context.Name) }; + var currentContext = new SchemaContext() { Id = CombineId(context.Id, name), Name = name, ParentId = context.Id, XPath = CombineXPath(context.XPath, context.Name), OrderOblivious = context.OrderOblivious }; var subSchemaPath = path.Combine(JsonPointer.Parse($"/{name}")); if (property.TryGetKeyword(out XsdTextKeyword xsdTextKeyword)) @@ -364,7 +371,7 @@ private void ProcessNonPrimitiveType(JsonPointer path, JsonSchema subSchema, Sch { ProcessRegularType(path, subSchema, context); - foreach (var keyword in subSchema.Keywords) + foreach (var keyword in subSchema.Keywords.OrderByPriority()) { var keywordPath = path.Combine(JsonPointer.Parse($"/{keyword.Keyword()}")); @@ -478,7 +485,8 @@ private void ProcessRegularType(JsonPointer path, JsonSchema subSchema, SchemaCo DataBindingName = GetDataBindingName(ElementType.Group, maxOccurs, id, null, xPath), DisplayString = GetDisplayString(id, typeName, minOccurs, maxOccurs), IsTagContent = context.XmlText, - Nillable = context.IsNillable + Nillable = context.IsNillable, + OrderOblivious = context.OrderOblivious }); } @@ -534,7 +542,8 @@ private void AddElement(JsonPointer path, JsonSchema subSchema, SchemaContext co DataBindingName = GetDataBindingName(@type, maxOccurs, id, fixedValue, xPath), DisplayString = GetDisplayString(id, context.SchemaValueType.ToString(), minOccurs, maxOccurs), IsTagContent = context.XmlText, - Nillable = context.IsNillable + Nillable = context.IsNillable, + OrderOblivious = context.OrderOblivious }); } diff --git a/backend/src/DataModeling/Metamodel/ElementMetadata.cs b/backend/src/DataModeling/Metamodel/ElementMetadata.cs index 21af5cd6cb6..2d23cabc6bf 100644 --- a/backend/src/DataModeling/Metamodel/ElementMetadata.cs +++ b/backend/src/DataModeling/Metamodel/ElementMetadata.cs @@ -169,5 +169,11 @@ public ElementMetadata() [JsonProperty(PropertyName = "nillable")] [JsonPropertyName("nillable")] public bool? Nillable { get; set; } + + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + [JsonProperty(PropertyName = "orderOblivious")] + [JsonPropertyName("orderOblivious")] + public bool OrderOblivious { get; set; } = false; } } diff --git a/backend/src/DataModeling/Utils/JsonSchemaExtensions.cs b/backend/src/DataModeling/Utils/JsonSchemaExtensions.cs index e43bc74f289..f7011677263 100644 --- a/backend/src/DataModeling/Utils/JsonSchemaExtensions.cs +++ b/backend/src/DataModeling/Utils/JsonSchemaExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Altinn.Studio.DataModeling.Json.Keywords; using Json.Schema; namespace Altinn.Studio.DataModeling.Utils @@ -185,5 +186,16 @@ public static JsonSchemaBuilder Type(this JsonSchemaBuilder builder, SchemaValue return builder; } + + /// + /// Orders the keywords by priority. + /// Currently the only keyword that should be prioritized is . + /// + /// + /// + public static IEnumerable OrderByPriority(this IEnumerable keywords) + { + return keywords.OrderBy(item => item.GetType() != typeof(XsdStructureKeyword)); + } } } diff --git a/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs b/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs index 2194ab689cc..5c65adc176d 100644 --- a/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs +++ b/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs @@ -1,11 +1,9 @@ -using System.IO; -using System.Linq; +using System.Linq; using System.Xml.Serialization; using Altinn.Studio.DataModeling.Converter.Csharp; using DataModeling.Tests.Assertions; using DataModeling.Tests.BaseClasses; using DataModeling.Tests.TestDataClasses; -using Designer.Tests.Factories.ModelFactory.DataClasses; using FluentAssertions; using SharedResources.Tests; using Xunit; diff --git a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpE2ERestrictionsTestData.cs b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpE2ERestrictionsTestData.cs index 5b5c2bfee6a..c1e971eafb5 100644 --- a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpE2ERestrictionsTestData.cs +++ b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpE2ERestrictionsTestData.cs @@ -9,36 +9,36 @@ public class CSharpE2ERestrictionsTestData : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t1", "string", "[MinLength(5)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t1", "string", "[MaxLength(20)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t2", "string", "[MinLength(10)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t2", "string", "[MaxLength(10)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t4", "string", @"[RegularExpression(@""^\d\.\d\.\d$"")]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", @"[RegularExpression(@""^-?(([0-9]){1}(\.)?){0,10}$"")]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", "[Range(-100d, 100d)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", "[Required]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i1", "int?", @"[RegularExpression(@""^-?[0-9]{0,10}$"")]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i1", "int?", "[Required]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i2", "decimal?", @"[RegularExpression(@""^-?[0-9]{0,10}$"")]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i2", "decimal?", "[Required]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", @"[RegularExpression(@""[0-9]+"")]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", "[MinLength(5)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", "[MaxLength(20)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeWithoutLimits", "int?", "[Range(Int32.MinValue, Int32.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeWithLimits", "int?", "[Range(-100, 100)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeLeftLimit", "int?", "[Range(-100, Int32.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeRightLimit", "int?", "[Range(Int32.MinValue, 100)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeWithoutLimits", "decimal?", "[Range(Double.MinValue, Double.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeWithLimits", "decimal?", "[Range(-100d, 100d)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeLeftLimit", "decimal?", "[Range(-100d, Double.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeRightLimit", "decimal?", "[Range(Double.MinValue, 100d)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeWithoutLimits", "long?", "[Range(Int64.MinValue, Int64.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeWithLimits", "long?", "[Range(-100, 100)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeLeftLimit", "long?", "[Range(-100, Int64.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeRightLimit", "long?", "[Range(Int64.MinValue, 100)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeWithLimits", "decimal?", "[Range(-100.0, 100.0)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeLeftLimit", "decimal?", "[Range(-100.0, Double.MaxValue)]" }; - yield return new object[] { "Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeRightLimit", "decimal?", "[Range(Double.MinValue, 100.0d)]" }; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t1", "string", "[MinLength(5)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t1", "string", "[MaxLength(20)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t2", "string", "[MinLength(10)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t2", "string", "[MaxLength(10)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "t4", "string", @"[RegularExpression(@""^\d\.\d\.\d$"")]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", @"[RegularExpression(@""^-?(([0-9]){1}(\.)?){0,10}$"")]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", "[Range(-100d, 100d)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "n1", "decimal?", "[Required]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i1", "int?", @"[RegularExpression(@""^-?[0-9]{0,10}$"")]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i1", "int?", "[Required]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i2", "decimal?", @"[RegularExpression(@""^-?[0-9]{0,10}$"")]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "i2", "decimal?", "[Required]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", @"[RegularExpression(@""[0-9]+"")]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", "[MinLength(5)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "nonPrimitive", "string", "[MaxLength(20)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeWithoutLimits", "int?", "[Range(Int32.MinValue, Int32.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeWithLimits", "int?", "[Range(-100, 100)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeLeftLimit", "int?", "[Range(-100, Int32.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "intRangeRightLimit", "int?", "[Range(Int32.MinValue, 100)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeWithoutLimits", "decimal?", "[Range(Double.MinValue, Double.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeWithLimits", "decimal?", "[Range(-100d, 100d)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeLeftLimit", "decimal?", "[Range(-100d, Double.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "integerRangeRightLimit", "decimal?", "[Range(Double.MinValue, 100d)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeWithoutLimits", "long?", "[Range(Int64.MinValue, Int64.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeWithLimits", "long?", "[Range(-100, 100)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeLeftLimit", "long?", "[Range(-100, Int64.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "longRangeRightLimit", "long?", "[Range(Int64.MinValue, 100)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeWithLimits", "decimal?", "[Range(-100.0, 100.0)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeLeftLimit", "decimal?", "[Range(-100.0, Double.MaxValue)]"]; + yield return ["Model/XmlSchema/General/SimpleTypeRestrictionsExtended.xsd", "decimalRangeRightLimit", "decimal?", "[Range(Double.MinValue, 100.0d)]"]; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs index 7667f6f2d85..098ce216a74 100644 --- a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs +++ b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs @@ -2,41 +2,47 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -namespace Designer.Tests.Factories.ModelFactory.DataClasses; +namespace DataModeling.Tests.TestDataClasses; [ExcludeFromCodeCoverage] public class CSharpEnd2EndTestData : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] { "Model/XmlSchema/Gitea/nsm-klareringsportalen.xsd", "Model/CSharp/Gitea/nsm-klareringsportalen.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-mu-bestilling-2021.xsd", "Model/CSharp/Gitea/stami-mu-bestilling-2021.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/dat-aarligmelding-bemanning.xsd", "Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/dihe-redusert-foreldrebetaling-bhg.xsd", "Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/hi-algeskjema.xsd", "Model/CSharp/Gitea/hi-algeskjema.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/Kursdomene_APINøkkel_M_2020-05-26_5702_34556_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_APINøkkel_M_2020-05-26_5702_34556_SERES.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/nbib-melding.xsd", "Model/CSharp/Gitea/nbib-melding.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/udir-invitasjon-vfkl.xsd", "Model/CSharp/Gitea/udir-invitasjon-vfkl.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/udir-vfkl.xsd", "Model/CSharp/Gitea/udir-vfkl.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/bokskjema.xsd", "Model/CSharp/Gitea/bokskjema.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/dat-bilpleie-soknad.xsd", "Model/CSharp/Gitea/dat-bilpleie-soknad.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/dat-skjema.xsd", "Model/CSharp/Gitea/dat-skjema.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/srf-fufinn-behovskartleggin.xsd", "Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/srf-melding-til-statsforvalteren.xsd", "Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/udi-unntak-karantenehotell-velferd.xsd", "Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/skjema.xsd", "Model/CSharp/Gitea/skjema.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/srf-fufinn-behovsendring.xsd", "Model/CSharp/Gitea/srf-fufinn-behovsendring.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-atid-databehandler-2022.xsd", "Model/CSharp/Gitea/stami-atid-databehandler-2022.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-mu-databehandler-2021.xsd", "Model/CSharp/Gitea/stami-mu-databehandler-2021.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd", "Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/aal-vedlegg.xsd", "Model/CSharp/Gitea/aal-vedlegg.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/krt-1188a-1.xsd", "Model/CSharp/Gitea/krt-1188a-1.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/3422-39646.xsd", "Model/CSharp/Gitea/3422-39646.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/3430-39615.xsd", "Model/CSharp/Gitea/3430-39615.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.xsd", "Model/CSharp/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.cs" }; - yield return new object[] { "Model/XmlSchema/Gitea/dev-nill-test.xsd", "Model/CSharp/Gitea/dev-nill-test.cs" }; + yield return ["Model/XmlSchema/Gitea/nsm-klareringsportalen.xsd", "Model/CSharp/Gitea/nsm-klareringsportalen.cs"]; + yield return ["Model/XmlSchema/Gitea/stami-mu-bestilling-2021.xsd", "Model/CSharp/Gitea/stami-mu-bestilling-2021.cs"]; + yield return ["Model/XmlSchema/Gitea/dat-aarligmelding-bemanning.xsd", "Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs"]; + yield return ["Model/XmlSchema/Gitea/dihe-redusert-foreldrebetaling-bhg.xsd", "Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs"]; + yield return ["Model/XmlSchema/Gitea/hi-algeskjema.xsd", "Model/CSharp/Gitea/hi-algeskjema.cs"]; + yield return ["Model/XmlSchema/Gitea/Kursdomene_APINøkkel_M_2020-05-26_5702_34556_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_APINøkkel_M_2020-05-26_5702_34556_SERES.cs"]; + yield return ["Model/XmlSchema/Gitea/nbib-melding.xsd", "Model/CSharp/Gitea/nbib-melding.cs"]; + yield return ["Model/XmlSchema/Gitea/udir-invitasjon-vfkl.xsd", "Model/CSharp/Gitea/udir-invitasjon-vfkl.cs"]; + yield return ["Model/XmlSchema/Gitea/udir-vfkl.xsd", "Model/CSharp/Gitea/udir-vfkl.cs"]; + yield return ["Model/XmlSchema/Gitea/bokskjema.xsd", "Model/CSharp/Gitea/bokskjema.cs"]; + yield return ["Model/XmlSchema/Gitea/dat-bilpleie-soknad.xsd", "Model/CSharp/Gitea/dat-bilpleie-soknad.cs"]; + yield return ["Model/XmlSchema/Gitea/dat-skjema.xsd", "Model/CSharp/Gitea/dat-skjema.cs"]; + yield return ["Model/XmlSchema/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs"]; + yield return ["Model/XmlSchema/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.xsd", "Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.cs"]; + yield return ["Model/XmlSchema/Gitea/srf-fufinn-behovskartleggin.xsd", "Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs"]; + yield return ["Model/XmlSchema/Gitea/srf-melding-til-statsforvalteren.xsd", "Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs"]; + yield return ["Model/XmlSchema/Gitea/udi-unntak-karantenehotell-velferd.xsd", "Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs"]; + yield return ["Model/XmlSchema/Gitea/skjema.xsd", "Model/CSharp/Gitea/skjema.cs"]; + yield return ["Model/XmlSchema/Gitea/srf-fufinn-behovsendring.xsd", "Model/CSharp/Gitea/srf-fufinn-behovsendring.cs"]; + yield return ["Model/XmlSchema/Gitea/stami-atid-databehandler-2022.xsd", "Model/CSharp/Gitea/stami-atid-databehandler-2022.cs"]; + yield return ["Model/XmlSchema/Gitea/stami-mu-databehandler-2021.xsd", "Model/CSharp/Gitea/stami-mu-databehandler-2021.cs"]; + yield return ["Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd", "Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs"]; + yield return ["Model/XmlSchema/Gitea/aal-vedlegg.xsd", "Model/CSharp/Gitea/aal-vedlegg.cs"]; + yield return ["Model/XmlSchema/Gitea/krt-1188a-1.xsd", "Model/CSharp/Gitea/krt-1188a-1.cs"]; + yield return ["Model/XmlSchema/Gitea/3422-39646.xsd", "Model/CSharp/Gitea/3422-39646.cs"]; + yield return ["Model/XmlSchema/Gitea/3430-39615.xsd", "Model/CSharp/Gitea/3430-39615.cs"]; + yield return ["Model/XmlSchema/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.xsd", "Model/CSharp/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.cs"]; + yield return ["Model/XmlSchema/Gitea/dev-nill-test.xsd", "Model/CSharp/Gitea/dev-nill-test.cs"]; + + // xs:all test cases + yield return ["Model/XmlSchema/XsAll/ferdigattest/v4/ferdigattest.xsd", "Model/CSharp/XsAll/ferdigattest/v4/ferdigattest.cs"]; + yield return ["Model/XmlSchema/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.xsd", "Model/CSharp/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.cs"]; + yield return ["Model/XmlSchema/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.xsd", "Model/CSharp/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.cs"]; + yield return ["Model/XmlSchema/XsAll/planvarsel/v2/planvarsel.xsd", "Model/CSharp/XsAll/planvarsel/v2/planvarsel.cs"]; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs b/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs index e947b01fcf8..0d5f7030983 100644 --- a/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs +++ b/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs @@ -7,19 +7,27 @@ public class ValidationTestData : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] { "Model/XmlSchema/Gitea/nsm-klareringsportalen.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-mu-bestilling-2021.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/dat-aarligmelding-bemanning.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/dihe-redusert-foreldrebetaling-bhg.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/nbib-melding.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/udir-vfkl.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/dat-bilpleie-soknad.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-atid-databehandler-2022.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/stami-mu-databehandler-2021.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd" }; - yield return new object[] { "Model/XmlSchema/Gitea/krt-1188a-1.xsd" }; + yield return ["Model/XmlSchema/Gitea/nsm-klareringsportalen.xsd"]; + yield return ["Model/XmlSchema/Gitea/stami-mu-bestilling-2021.xsd"]; + yield return ["Model/XmlSchema/Gitea/dat-aarligmelding-bemanning.xsd"]; + yield return ["Model/XmlSchema/Gitea/dihe-redusert-foreldrebetaling-bhg.xsd"]; + yield return ["Model/XmlSchema/Gitea/nbib-melding.xsd"]; + yield return ["Model/XmlSchema/Gitea/udir-vfkl.xsd"]; + yield return ["Model/XmlSchema/Gitea/dat-bilpleie-soknad.xsd"]; + yield return ["Model/XmlSchema/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.xsd"]; + yield return ["Model/XmlSchema/Gitea/Kursdomene_BekrefteBruksvilkår_M_2020-05-25_5704_34554_SERES.xsd"]; + yield return ["Model/XmlSchema/Gitea/stami-atid-databehandler-2022.xsd"]; + yield return ["Model/XmlSchema/Gitea/stami-mu-databehandler-2021.xsd"]; + yield return ["Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd"]; + yield return ["Model/XmlSchema/Gitea/krt-1188a-1.xsd"]; + + // xs:all test cases + // some of are not supported due to not precise date regex + // yield return ["Model/XmlSchema/XsAll/ferdigattest/v4/ferdigattest.xsd"]; + // yield return ["Model/XmlSchema/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.xsd"]; + // yield return ["Model/XmlSchema/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.xsd"]; + yield return ["Model/XmlSchema/XsAll/planvarsel/v2/planvarsel.xsd"]; + // Can generate non valid date string from regex // yield return new object[] { "Model/XmlSchema/Gitea/hi-algeskjema.xsd" }; diff --git a/testdata/Model/CSharp/XsAll/ferdigattest/v4/ferdigattest.cs b/testdata/Model/CSharp/XsAll/ferdigattest/v4/ferdigattest.cs new file mode 100644 index 00000000000..bf702a88ee4 --- /dev/null +++ b/testdata/Model/CSharp/XsAll/ferdigattest/v4/ferdigattest.cs @@ -0,0 +1,599 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="ferdigattest", Namespace="https://skjema.ft.dibk.no/ferdigattest/v4")] + public class FerdigattestType + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "DIBK"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "10005"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "4"; + + [XmlElement("eiendomByggested")] + [JsonProperty("eiendomByggested")] + [JsonPropertyName("eiendomByggested")] + public EiendomListe eiendomByggested { get; set; } + + [XmlElement("kommunensSaksnummer")] + [JsonProperty("kommunensSaksnummer")] + [JsonPropertyName("kommunensSaksnummer")] + public SaksnummerType kommunensSaksnummer { get; set; } + + [XmlElement("metadata")] + [JsonProperty("metadata")] + [JsonPropertyName("metadata")] + public MetadataType metadata { get; set; } + + [XmlElement("generelleVilkaar")] + [JsonProperty("generelleVilkaar")] + [JsonPropertyName("generelleVilkaar")] + public GenerelleVilkaarType generelleVilkaar { get; set; } + + [XmlElement("soeknadGjelder")] + [JsonProperty("soeknadGjelder")] + [JsonPropertyName("soeknadGjelder")] + public BeskrivelseAvTiltakType soeknadGjelder { get; set; } + + [XmlElement("utfallBesvarelse")] + [JsonProperty("utfallBesvarelse")] + [JsonPropertyName("utfallBesvarelse")] + public UtfallSvarListe utfallBesvarelse { get; set; } + + [XmlElement("kravFerdigattest")] + [JsonProperty("kravFerdigattest")] + [JsonPropertyName("kravFerdigattest")] + public KravFerdigattestType kravFerdigattest { get; set; } + + [XmlElement("foretattIkkeSoeknadspliktigeJusteringer")] + [JsonProperty("foretattIkkeSoeknadspliktigeJusteringer")] + [JsonPropertyName("foretattIkkeSoeknadspliktigeJusteringer")] + public bool? foretattIkkeSoeknadspliktigeJusteringer { get; set; } + + [XmlElement("tilstrekkeligDokumentasjonOverlevertEier")] + [JsonProperty("tilstrekkeligDokumentasjonOverlevertEier")] + [JsonPropertyName("tilstrekkeligDokumentasjonOverlevertEier")] + public bool? tilstrekkeligDokumentasjonOverlevertEier { get; set; } + + [XmlElement("varmesystem")] + [JsonProperty("varmesystem")] + [JsonPropertyName("varmesystem")] + public VarmesystemType varmesystem { get; set; } + + [XmlElement("tiltakshaver")] + [JsonProperty("tiltakshaver")] + [JsonPropertyName("tiltakshaver")] + public PartType tiltakshaver { get; set; } + + [XmlElement("ansvarligSoeker")] + [JsonProperty("ansvarligSoeker")] + [JsonPropertyName("ansvarligSoeker")] + public PartType ansvarligSoeker { get; set; } + + [XmlElement("ansvarForByggesaken")] + [JsonProperty("ansvarForByggesaken")] + [JsonPropertyName("ansvarForByggesaken")] + public KodeType ansvarForByggesaken { get; set; } + + } + + public class EiendomListe + { + [XmlElement("eiendom")] + [JsonProperty("eiendom")] + [JsonPropertyName("eiendom")] + public List eiendom { get; set; } + + } + + public class EiendomType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("eiendomsidentifikasjon")] + [JsonProperty("eiendomsidentifikasjon")] + [JsonPropertyName("eiendomsidentifikasjon")] + public MatrikkelnummerType eiendomsidentifikasjon { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EiendommensAdresseType adresse { get; set; } + + [XmlElement("bygningsnummer")] + [JsonProperty("bygningsnummer")] + [JsonPropertyName("bygningsnummer")] + public string bygningsnummer { get; set; } + + [XmlElement("bolignummer")] + [JsonProperty("bolignummer")] + [JsonPropertyName("bolignummer")] + public string bolignummer { get; set; } + + [XmlElement("kommunenavn")] + [JsonProperty("kommunenavn")] + [JsonPropertyName("kommunenavn")] + public string kommunenavn { get; set; } + + } + + public class MatrikkelnummerType + { + [XmlElement("kommunenummer")] + [JsonProperty("kommunenummer")] + [JsonPropertyName("kommunenummer")] + public string kommunenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("gaardsnummer")] + [JsonProperty("gaardsnummer")] + [JsonPropertyName("gaardsnummer")] + public int? gaardsnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("bruksnummer")] + [JsonProperty("bruksnummer")] + [JsonPropertyName("bruksnummer")] + public int? bruksnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("festenummer")] + [JsonProperty("festenummer")] + [JsonPropertyName("festenummer")] + public int? festenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("seksjonsnummer")] + [JsonProperty("seksjonsnummer")] + [JsonPropertyName("seksjonsnummer")] + public int? seksjonsnummer { get; set; } + + } + + public class EiendommensAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + [XmlElement("gatenavn")] + [JsonProperty("gatenavn")] + [JsonPropertyName("gatenavn")] + public string gatenavn { get; set; } + + [XmlElement("husnr")] + [JsonProperty("husnr")] + [JsonPropertyName("husnr")] + public string husnr { get; set; } + + [XmlElement("bokstav")] + [JsonProperty("bokstav")] + [JsonPropertyName("bokstav")] + public string bokstav { get; set; } + + } + + public class SaksnummerType + { + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("saksaar")] + [JsonProperty("saksaar")] + [JsonPropertyName("saksaar")] + public int? saksaar { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("sakssekvensnummer")] + [JsonProperty("sakssekvensnummer")] + [JsonPropertyName("sakssekvensnummer")] + public int? sakssekvensnummer { get; set; } + + } + + public class MetadataType + { + [XmlElement("fraSluttbrukersystem")] + [JsonProperty("fraSluttbrukersystem")] + [JsonPropertyName("fraSluttbrukersystem")] + public string fraSluttbrukersystem { get; set; } + + [XmlElement("ftbId")] + [JsonProperty("ftbId")] + [JsonPropertyName("ftbId")] + public string ftbId { get; set; } + + [XmlElement("prosjektnavn")] + [JsonProperty("prosjektnavn")] + [JsonPropertyName("prosjektnavn")] + public string prosjektnavn { get; set; } + + [XmlElement("prosjektnr")] + [JsonProperty("prosjektnr")] + [JsonPropertyName("prosjektnr")] + public string prosjektnr { get; set; } + + [XmlElement("foretrukketSpraak")] + [JsonProperty("foretrukketSpraak")] + [JsonPropertyName("foretrukketSpraak")] + public KodeType foretrukketSpraak { get; set; } + + } + + public class KodeType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("kodeverdi")] + [JsonProperty("kodeverdi")] + [JsonPropertyName("kodeverdi")] + public string kodeverdi { get; set; } + + [XmlElement("kodebeskrivelse")] + [JsonProperty("kodebeskrivelse")] + [JsonPropertyName("kodebeskrivelse")] + public string kodebeskrivelse { get; set; } + + } + + public class GenerelleVilkaarType + { + [XmlElement("norskSvenskDansk")] + [JsonProperty("norskSvenskDansk")] + [JsonPropertyName("norskSvenskDansk")] + public bool? norskSvenskDansk { get; set; } + + } + + public class BeskrivelseAvTiltakType + { + [XmlElement("type")] + [JsonProperty("type")] + [JsonPropertyName("type")] + public KodeListe type { get; set; } + + [XmlElement("foelgebrev")] + [JsonProperty("foelgebrev")] + [JsonPropertyName("foelgebrev")] + public string foelgebrev { get; set; } + + } + + public class KodeListe + { + [XmlElement("kode")] + [JsonProperty("kode")] + [JsonPropertyName("kode")] + public List kode { get; set; } + + } + + public class UtfallSvarListe + { + [XmlElement("utfallSvar")] + [JsonProperty("utfallSvar")] + [JsonPropertyName("utfallSvar")] + public List utfallSvar { get; set; } + + } + + public class UtfallSvarType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("utfallId")] + [JsonProperty("utfallId")] + [JsonPropertyName("utfallId")] + public string utfallId { get; set; } + + [XmlElement("utfallType")] + [JsonProperty("utfallType")] + [JsonPropertyName("utfallType")] + public KodeType utfallType { get; set; } + + [XmlElement("utloestFraSjekkpunkt")] + [JsonProperty("utloestFraSjekkpunkt")] + [JsonPropertyName("utloestFraSjekkpunkt")] + public SjekkpunktType utloestFraSjekkpunkt { get; set; } + + [XmlElement("tema")] + [JsonProperty("tema")] + [JsonPropertyName("tema")] + public KodeType tema { get; set; } + + [XmlElement("tittel")] + [JsonProperty("tittel")] + [JsonPropertyName("tittel")] + public string tittel { get; set; } + + [XmlElement("beskrivelse")] + [JsonProperty("beskrivelse")] + [JsonPropertyName("beskrivelse")] + public string beskrivelse { get; set; } + + [XmlElement("erUtfallBesvaresSenere")] + [JsonProperty("erUtfallBesvaresSenere")] + [JsonPropertyName("erUtfallBesvaresSenere")] + public bool? erUtfallBesvaresSenere { get; set; } + + [XmlElement("erUtfallBesvart")] + [JsonProperty("erUtfallBesvart")] + [JsonPropertyName("erUtfallBesvart")] + public bool? erUtfallBesvart { get; set; } + + [XmlElement("kommentar")] + [JsonProperty("kommentar")] + [JsonPropertyName("kommentar")] + public string kommentar { get; set; } + + [XmlElement("vedleggsliste")] + [JsonProperty("vedleggsliste")] + [JsonPropertyName("vedleggsliste")] + public VedleggListe vedleggsliste { get; set; } + + } + + public class SjekkpunktType + { + [XmlElement("sjekkpunktId")] + [JsonProperty("sjekkpunktId")] + [JsonPropertyName("sjekkpunktId")] + public string sjekkpunktId { get; set; } + + [XmlElement("sjekkpunktEier")] + [JsonProperty("sjekkpunktEier")] + [JsonPropertyName("sjekkpunktEier")] + public string sjekkpunktEier { get; set; } + + } + + public class VedleggListe + { + [XmlElement("vedlegg")] + [JsonProperty("vedlegg")] + [JsonPropertyName("vedlegg")] + public List vedlegg { get; set; } + + } + + public class VedleggType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("versjonsnummer")] + [JsonProperty("versjonsnummer")] + [JsonPropertyName("versjonsnummer")] + public string versjonsnummer { get; set; } + + [XmlElement("vedleggstype")] + [JsonProperty("vedleggstype")] + [JsonPropertyName("vedleggstype")] + public KodeType vedleggstype { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("versjonsdato")] + [JsonProperty("versjonsdato")] + [JsonPropertyName("versjonsdato")] + public string versjonsdato { get; set; } + + [XmlElement("filnavn")] + [JsonProperty("filnavn")] + [JsonPropertyName("filnavn")] + public string filnavn { get; set; } + + } + + public class KravFerdigattestType + { + [XmlElement("tilfredsstillerTiltaketKraveneFerdigattest")] + [JsonProperty("tilfredsstillerTiltaketKraveneFerdigattest")] + [JsonPropertyName("tilfredsstillerTiltaketKraveneFerdigattest")] + public bool? tilfredsstillerTiltaketKraveneFerdigattest { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("utfoertInnen")] + [JsonProperty("utfoertInnen")] + [JsonPropertyName("utfoertInnen")] + public string utfoertInnen { get; set; } + + [XmlElement("typeArbeider")] + [JsonProperty("typeArbeider")] + [JsonPropertyName("typeArbeider")] + public string typeArbeider { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("bekreftelseInnen")] + [JsonProperty("bekreftelseInnen")] + [JsonPropertyName("bekreftelseInnen")] + public string bekreftelseInnen { get; set; } + + } + + public class VarmesystemType + { + [XmlElement("varmefordeling")] + [JsonProperty("varmefordeling")] + [JsonPropertyName("varmefordeling")] + public KodeListe varmefordeling { get; set; } + + [XmlElement("energiforsyning")] + [JsonProperty("energiforsyning")] + [JsonPropertyName("energiforsyning")] + public KodeListe energiforsyning { get; set; } + + [XmlElement("relevant")] + [JsonProperty("relevant")] + [JsonPropertyName("relevant")] + public bool? relevant { get; set; } + + } + + public class PartType + { + [XmlElement("partstype")] + [JsonProperty("partstype")] + [JsonPropertyName("partstype")] + public KodeType partstype { get; set; } + + [XmlElement("foedselsnummer")] + [JsonProperty("foedselsnummer")] + [JsonPropertyName("foedselsnummer")] + public string foedselsnummer { get; set; } + + [XmlElement("organisasjonsnummer")] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public string organisasjonsnummer { get; set; } + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EnkelAdresseType adresse { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + [XmlElement("kontaktperson")] + [JsonProperty("kontaktperson")] + [JsonPropertyName("kontaktperson")] + public KontaktpersonType kontaktperson { get; set; } + + } + + public class EnkelAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + } + + public class KontaktpersonType + { + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + } +} diff --git a/testdata/Model/CSharp/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.cs b/testdata/Model/CSharp/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.cs new file mode 100644 index 00000000000..195769e2aee --- /dev/null +++ b/testdata/Model/CSharp/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.cs @@ -0,0 +1,601 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="igangsettingstillatelse", Namespace="https://skjema.ft.dibk.no/igangsettingstillatelse/v4")] + public class IgangsettingstillatelseType + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "DIBK"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "10003"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "4"; + + [XmlElement("eiendomByggested")] + [JsonProperty("eiendomByggested")] + [JsonPropertyName("eiendomByggested")] + public EiendomListe eiendomByggested { get; set; } + + [XmlElement("kommunensSaksnummer")] + [JsonProperty("kommunensSaksnummer")] + [JsonPropertyName("kommunensSaksnummer")] + public SaksnummerType kommunensSaksnummer { get; set; } + + [XmlElement("metadata")] + [JsonProperty("metadata")] + [JsonPropertyName("metadata")] + public MetadataType metadata { get; set; } + + [XmlElement("generelleVilkaar")] + [JsonProperty("generelleVilkaar")] + [JsonPropertyName("generelleVilkaar")] + public GenerelleVilkaarType generelleVilkaar { get; set; } + + [XmlElement("soeknadGjelder")] + [JsonProperty("soeknadGjelder")] + [JsonPropertyName("soeknadGjelder")] + public SoeknadenGjelderType soeknadGjelder { get; set; } + + [XmlElement("delsoeknader")] + [JsonProperty("delsoeknader")] + [JsonPropertyName("delsoeknader")] + public DelsoeknadListe delsoeknader { get; set; } + + [XmlElement("utfallBesvarelse")] + [JsonProperty("utfallBesvarelse")] + [JsonPropertyName("utfallBesvarelse")] + public UtfallSvarListe utfallBesvarelse { get; set; } + + [XmlElement("ansvarligSoeker")] + [JsonProperty("ansvarligSoeker")] + [JsonPropertyName("ansvarligSoeker")] + public PartType ansvarligSoeker { get; set; } + + [XmlElement("ansvarForByggesaken")] + [JsonProperty("ansvarForByggesaken")] + [JsonPropertyName("ansvarForByggesaken")] + public KodeType ansvarForByggesaken { get; set; } + + } + + public class EiendomListe + { + [XmlElement("eiendom")] + [JsonProperty("eiendom")] + [JsonPropertyName("eiendom")] + public List eiendom { get; set; } + + } + + public class EiendomType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("eiendomsidentifikasjon")] + [JsonProperty("eiendomsidentifikasjon")] + [JsonPropertyName("eiendomsidentifikasjon")] + public MatrikkelnummerType eiendomsidentifikasjon { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EiendommensAdresseType adresse { get; set; } + + [XmlElement("bygningsnummer")] + [JsonProperty("bygningsnummer")] + [JsonPropertyName("bygningsnummer")] + public string bygningsnummer { get; set; } + + [XmlElement("bolignummer")] + [JsonProperty("bolignummer")] + [JsonPropertyName("bolignummer")] + public string bolignummer { get; set; } + + [XmlElement("kommunenavn")] + [JsonProperty("kommunenavn")] + [JsonPropertyName("kommunenavn")] + public string kommunenavn { get; set; } + + } + + public class MatrikkelnummerType + { + [XmlElement("kommunenummer")] + [JsonProperty("kommunenummer")] + [JsonPropertyName("kommunenummer")] + public string kommunenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("gaardsnummer")] + [JsonProperty("gaardsnummer")] + [JsonPropertyName("gaardsnummer")] + public int? gaardsnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("bruksnummer")] + [JsonProperty("bruksnummer")] + [JsonPropertyName("bruksnummer")] + public int? bruksnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("festenummer")] + [JsonProperty("festenummer")] + [JsonPropertyName("festenummer")] + public int? festenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("seksjonsnummer")] + [JsonProperty("seksjonsnummer")] + [JsonPropertyName("seksjonsnummer")] + public int? seksjonsnummer { get; set; } + + } + + public class EiendommensAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + [XmlElement("gatenavn")] + [JsonProperty("gatenavn")] + [JsonPropertyName("gatenavn")] + public string gatenavn { get; set; } + + [XmlElement("husnr")] + [JsonProperty("husnr")] + [JsonPropertyName("husnr")] + public string husnr { get; set; } + + [XmlElement("bokstav")] + [JsonProperty("bokstav")] + [JsonPropertyName("bokstav")] + public string bokstav { get; set; } + + } + + public class SaksnummerType + { + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("saksaar")] + [JsonProperty("saksaar")] + [JsonPropertyName("saksaar")] + public int? saksaar { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("sakssekvensnummer")] + [JsonProperty("sakssekvensnummer")] + [JsonPropertyName("sakssekvensnummer")] + public int? sakssekvensnummer { get; set; } + + } + + public class MetadataType + { + [XmlElement("fraSluttbrukersystem")] + [JsonProperty("fraSluttbrukersystem")] + [JsonPropertyName("fraSluttbrukersystem")] + public string fraSluttbrukersystem { get; set; } + + [XmlElement("ftbId")] + [JsonProperty("ftbId")] + [JsonPropertyName("ftbId")] + public string ftbId { get; set; } + + [XmlElement("prosjektnavn")] + [JsonProperty("prosjektnavn")] + [JsonPropertyName("prosjektnavn")] + public string prosjektnavn { get; set; } + + [XmlElement("prosjektnr")] + [JsonProperty("prosjektnr")] + [JsonPropertyName("prosjektnr")] + public string prosjektnr { get; set; } + + [XmlElement("foretrukketSpraak")] + [JsonProperty("foretrukketSpraak")] + [JsonPropertyName("foretrukketSpraak")] + public KodeType foretrukketSpraak { get; set; } + + } + + public class KodeType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("kodeverdi")] + [JsonProperty("kodeverdi")] + [JsonPropertyName("kodeverdi")] + public string kodeverdi { get; set; } + + [XmlElement("kodebeskrivelse")] + [JsonProperty("kodebeskrivelse")] + [JsonPropertyName("kodebeskrivelse")] + public string kodebeskrivelse { get; set; } + + } + + public class GenerelleVilkaarType + { + [XmlElement("beroererArbeidsplasser")] + [JsonProperty("beroererArbeidsplasser")] + [JsonPropertyName("beroererArbeidsplasser")] + public bool? beroererArbeidsplasser { get; set; } + + [XmlElement("norskSvenskDansk")] + [JsonProperty("norskSvenskDansk")] + [JsonPropertyName("norskSvenskDansk")] + public bool? norskSvenskDansk { get; set; } + + } + + public class SoeknadenGjelderType + { + [XmlElement("gjelderHeleTiltaket")] + [JsonProperty("gjelderHeleTiltaket")] + [JsonPropertyName("gjelderHeleTiltaket")] + public bool? gjelderHeleTiltaket { get; set; } + + [XmlElement("delAvTiltaket")] + [JsonProperty("delAvTiltaket")] + [JsonPropertyName("delAvTiltaket")] + public string delAvTiltaket { get; set; } + + [XmlElement("type")] + [JsonProperty("type")] + [JsonPropertyName("type")] + public KodeListe type { get; set; } + + [XmlElement("delsoeknadsnummer")] + [JsonProperty("delsoeknadsnummer")] + [JsonPropertyName("delsoeknadsnummer")] + public string delsoeknadsnummer { get; set; } + + [XmlElement("foelgebrev")] + [JsonProperty("foelgebrev")] + [JsonPropertyName("foelgebrev")] + public string foelgebrev { get; set; } + + } + + public class KodeListe + { + [XmlElement("kode")] + [JsonProperty("kode")] + [JsonPropertyName("kode")] + public List kode { get; set; } + + } + + public class DelsoeknadListe + { + [XmlElement("delsoeknad")] + [JsonProperty("delsoeknad")] + [JsonPropertyName("delsoeknad")] + public List delsoeknad { get; set; } + + } + + public class DelsoeknadType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("delAvTiltaket")] + [JsonProperty("delAvTiltaket")] + [JsonPropertyName("delAvTiltaket")] + public string delAvTiltaket { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("tillatelsedato")] + [JsonProperty("tillatelsedato")] + [JsonPropertyName("tillatelsedato")] + public string tillatelsedato { get; set; } + + [XmlElement("kommentar")] + [JsonProperty("kommentar")] + [JsonPropertyName("kommentar")] + public string kommentar { get; set; } + + [XmlElement("type")] + [JsonProperty("type")] + [JsonPropertyName("type")] + public KodeListe type { get; set; } + + [XmlElement("delsoeknadsnummer")] + [JsonProperty("delsoeknadsnummer")] + [JsonPropertyName("delsoeknadsnummer")] + public string delsoeknadsnummer { get; set; } + + } + + public class UtfallSvarListe + { + [XmlElement("utfallSvar")] + [JsonProperty("utfallSvar")] + [JsonPropertyName("utfallSvar")] + public List utfallSvar { get; set; } + + } + + public class UtfallSvarType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("utfallId")] + [JsonProperty("utfallId")] + [JsonPropertyName("utfallId")] + public string utfallId { get; set; } + + [XmlElement("utfallType")] + [JsonProperty("utfallType")] + [JsonPropertyName("utfallType")] + public KodeType utfallType { get; set; } + + [XmlElement("utloestFraSjekkpunkt")] + [JsonProperty("utloestFraSjekkpunkt")] + [JsonPropertyName("utloestFraSjekkpunkt")] + public SjekkpunktType utloestFraSjekkpunkt { get; set; } + + [XmlElement("tema")] + [JsonProperty("tema")] + [JsonPropertyName("tema")] + public KodeType tema { get; set; } + + [XmlElement("tittel")] + [JsonProperty("tittel")] + [JsonPropertyName("tittel")] + public string tittel { get; set; } + + [XmlElement("beskrivelse")] + [JsonProperty("beskrivelse")] + [JsonPropertyName("beskrivelse")] + public string beskrivelse { get; set; } + + [XmlElement("erUtfallBesvaresSenere")] + [JsonProperty("erUtfallBesvaresSenere")] + [JsonPropertyName("erUtfallBesvaresSenere")] + public bool? erUtfallBesvaresSenere { get; set; } + + [XmlElement("erUtfallBesvart")] + [JsonProperty("erUtfallBesvart")] + [JsonPropertyName("erUtfallBesvart")] + public bool? erUtfallBesvart { get; set; } + + [XmlElement("kommentar")] + [JsonProperty("kommentar")] + [JsonPropertyName("kommentar")] + public string kommentar { get; set; } + + [XmlElement("vedleggsliste")] + [JsonProperty("vedleggsliste")] + [JsonPropertyName("vedleggsliste")] + public VedleggListe vedleggsliste { get; set; } + + } + + public class SjekkpunktType + { + [XmlElement("sjekkpunktId")] + [JsonProperty("sjekkpunktId")] + [JsonPropertyName("sjekkpunktId")] + public string sjekkpunktId { get; set; } + + [XmlElement("sjekkpunktEier")] + [JsonProperty("sjekkpunktEier")] + [JsonPropertyName("sjekkpunktEier")] + public string sjekkpunktEier { get; set; } + + } + + public class VedleggListe + { + [XmlElement("vedlegg")] + [JsonProperty("vedlegg")] + [JsonPropertyName("vedlegg")] + public List vedlegg { get; set; } + + } + + public class VedleggType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("versjonsnummer")] + [JsonProperty("versjonsnummer")] + [JsonPropertyName("versjonsnummer")] + public string versjonsnummer { get; set; } + + [XmlElement("vedleggstype")] + [JsonProperty("vedleggstype")] + [JsonPropertyName("vedleggstype")] + public KodeType vedleggstype { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("versjonsdato")] + [JsonProperty("versjonsdato")] + [JsonPropertyName("versjonsdato")] + public string versjonsdato { get; set; } + + [XmlElement("filnavn")] + [JsonProperty("filnavn")] + [JsonPropertyName("filnavn")] + public string filnavn { get; set; } + + } + + public class PartType + { + [XmlElement("partstype")] + [JsonProperty("partstype")] + [JsonPropertyName("partstype")] + public KodeType partstype { get; set; } + + [XmlElement("foedselsnummer")] + [JsonProperty("foedselsnummer")] + [JsonPropertyName("foedselsnummer")] + public string foedselsnummer { get; set; } + + [XmlElement("organisasjonsnummer")] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public string organisasjonsnummer { get; set; } + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EnkelAdresseType adresse { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + [XmlElement("kontaktperson")] + [JsonProperty("kontaktperson")] + [JsonPropertyName("kontaktperson")] + public KontaktpersonType kontaktperson { get; set; } + + } + + public class EnkelAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + } + + public class KontaktpersonType + { + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + } +} diff --git a/testdata/Model/CSharp/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.cs b/testdata/Model/CSharp/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.cs new file mode 100644 index 00000000000..3a1deb36cc8 --- /dev/null +++ b/testdata/Model/CSharp/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.cs @@ -0,0 +1,657 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="midlertidigbrukstillatelse", Namespace="https://skjema.ft.dibk.no/midlertidigbrukstillatelse/v4")] + public class MidlertidigBrukstillatelseType + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "DIBK"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "10004"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "4"; + + [XmlElement("eiendomByggested")] + [JsonProperty("eiendomByggested")] + [JsonPropertyName("eiendomByggested")] + public EiendomListe eiendomByggested { get; set; } + + [XmlElement("kommunensSaksnummer")] + [JsonProperty("kommunensSaksnummer")] + [JsonPropertyName("kommunensSaksnummer")] + public SaksnummerType kommunensSaksnummer { get; set; } + + [XmlElement("metadata")] + [JsonProperty("metadata")] + [JsonPropertyName("metadata")] + public MetadataType metadata { get; set; } + + [XmlElement("generelleVilkaar")] + [JsonProperty("generelleVilkaar")] + [JsonPropertyName("generelleVilkaar")] + public GenerelleVilkaarType generelleVilkaar { get; set; } + + [XmlElement("soeknadGjelder")] + [JsonProperty("soeknadGjelder")] + [JsonPropertyName("soeknadGjelder")] + public SoeknadGjelderType soeknadGjelder { get; set; } + + [XmlElement("delsoeknader")] + [JsonProperty("delsoeknader")] + [JsonPropertyName("delsoeknader")] + public DelsoeknadListe delsoeknader { get; set; } + + [XmlElement("utfallBesvarelse")] + [JsonProperty("utfallBesvarelse")] + [JsonPropertyName("utfallBesvarelse")] + public UtfallSvarListe utfallBesvarelse { get; set; } + + [XmlElement("tiltakshaver")] + [JsonProperty("tiltakshaver")] + [JsonPropertyName("tiltakshaver")] + public PartType tiltakshaver { get; set; } + + [XmlElement("ansvarligSoeker")] + [JsonProperty("ansvarligSoeker")] + [JsonPropertyName("ansvarligSoeker")] + public PartType ansvarligSoeker { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("datoFerdigattest")] + [JsonProperty("datoFerdigattest")] + [JsonPropertyName("datoFerdigattest")] + public string datoFerdigattest { get; set; } + + [XmlElement("gjenstaaendeArbeider")] + [JsonProperty("gjenstaaendeArbeider")] + [JsonPropertyName("gjenstaaendeArbeider")] + public GjenstaaendeArbeiderType gjenstaaendeArbeider { get; set; } + + [XmlElement("sikkerhetsnivaa")] + [JsonProperty("sikkerhetsnivaa")] + [JsonPropertyName("sikkerhetsnivaa")] + public SikkerhetsnivaaType sikkerhetsnivaa { get; set; } + + [XmlElement("ansvarForByggesaken")] + [JsonProperty("ansvarForByggesaken")] + [JsonPropertyName("ansvarForByggesaken")] + public KodeType ansvarForByggesaken { get; set; } + + } + + public class EiendomListe + { + [XmlElement("eiendom")] + [JsonProperty("eiendom")] + [JsonPropertyName("eiendom")] + public List eiendom { get; set; } + + } + + public class EiendomType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("eiendomsidentifikasjon")] + [JsonProperty("eiendomsidentifikasjon")] + [JsonPropertyName("eiendomsidentifikasjon")] + public MatrikkelnummerType eiendomsidentifikasjon { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EiendommensAdresseType adresse { get; set; } + + [XmlElement("bygningsnummer")] + [JsonProperty("bygningsnummer")] + [JsonPropertyName("bygningsnummer")] + public string bygningsnummer { get; set; } + + [XmlElement("bolignummer")] + [JsonProperty("bolignummer")] + [JsonPropertyName("bolignummer")] + public string bolignummer { get; set; } + + [XmlElement("kommunenavn")] + [JsonProperty("kommunenavn")] + [JsonPropertyName("kommunenavn")] + public string kommunenavn { get; set; } + + } + + public class MatrikkelnummerType + { + [XmlElement("kommunenummer")] + [JsonProperty("kommunenummer")] + [JsonPropertyName("kommunenummer")] + public string kommunenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("gaardsnummer")] + [JsonProperty("gaardsnummer")] + [JsonPropertyName("gaardsnummer")] + public int? gaardsnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("bruksnummer")] + [JsonProperty("bruksnummer")] + [JsonPropertyName("bruksnummer")] + public int? bruksnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("festenummer")] + [JsonProperty("festenummer")] + [JsonPropertyName("festenummer")] + public int? festenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("seksjonsnummer")] + [JsonProperty("seksjonsnummer")] + [JsonPropertyName("seksjonsnummer")] + public int? seksjonsnummer { get; set; } + + } + + public class EiendommensAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + [XmlElement("gatenavn")] + [JsonProperty("gatenavn")] + [JsonPropertyName("gatenavn")] + public string gatenavn { get; set; } + + [XmlElement("husnr")] + [JsonProperty("husnr")] + [JsonPropertyName("husnr")] + public string husnr { get; set; } + + [XmlElement("bokstav")] + [JsonProperty("bokstav")] + [JsonPropertyName("bokstav")] + public string bokstav { get; set; } + + } + + public class SaksnummerType + { + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("saksaar")] + [JsonProperty("saksaar")] + [JsonPropertyName("saksaar")] + public int? saksaar { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("sakssekvensnummer")] + [JsonProperty("sakssekvensnummer")] + [JsonPropertyName("sakssekvensnummer")] + public int? sakssekvensnummer { get; set; } + + } + + public class MetadataType + { + [XmlElement("fraSluttbrukersystem")] + [JsonProperty("fraSluttbrukersystem")] + [JsonPropertyName("fraSluttbrukersystem")] + public string fraSluttbrukersystem { get; set; } + + [XmlElement("ftbId")] + [JsonProperty("ftbId")] + [JsonPropertyName("ftbId")] + public string ftbId { get; set; } + + [XmlElement("prosjektnavn")] + [JsonProperty("prosjektnavn")] + [JsonPropertyName("prosjektnavn")] + public string prosjektnavn { get; set; } + + [XmlElement("prosjektnr")] + [JsonProperty("prosjektnr")] + [JsonPropertyName("prosjektnr")] + public string prosjektnr { get; set; } + + [XmlElement("foretrukketSpraak")] + [JsonProperty("foretrukketSpraak")] + [JsonPropertyName("foretrukketSpraak")] + public KodeType foretrukketSpraak { get; set; } + + } + + public class KodeType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("kodeverdi")] + [JsonProperty("kodeverdi")] + [JsonPropertyName("kodeverdi")] + public string kodeverdi { get; set; } + + [XmlElement("kodebeskrivelse")] + [JsonProperty("kodebeskrivelse")] + [JsonPropertyName("kodebeskrivelse")] + public string kodebeskrivelse { get; set; } + + } + + public class GenerelleVilkaarType + { + [XmlElement("norskSvenskDansk")] + [JsonProperty("norskSvenskDansk")] + [JsonPropertyName("norskSvenskDansk")] + public bool? norskSvenskDansk { get; set; } + + } + + public class SoeknadGjelderType + { + [XmlElement("gjelderHeleTiltaket")] + [JsonProperty("gjelderHeleTiltaket")] + [JsonPropertyName("gjelderHeleTiltaket")] + public bool? gjelderHeleTiltaket { get; set; } + + [XmlElement("delAvTiltaket")] + [JsonProperty("delAvTiltaket")] + [JsonPropertyName("delAvTiltaket")] + public string delAvTiltaket { get; set; } + + [XmlElement("type")] + [JsonProperty("type")] + [JsonPropertyName("type")] + public KodeListe type { get; set; } + + [XmlElement("delsoeknadsnummer")] + [JsonProperty("delsoeknadsnummer")] + [JsonPropertyName("delsoeknadsnummer")] + public string delsoeknadsnummer { get; set; } + + [XmlElement("foelgebrev")] + [JsonProperty("foelgebrev")] + [JsonPropertyName("foelgebrev")] + public string foelgebrev { get; set; } + + } + + public class KodeListe + { + [XmlElement("kode")] + [JsonProperty("kode")] + [JsonPropertyName("kode")] + public List kode { get; set; } + + } + + public class DelsoeknadListe + { + [XmlElement("delsoeknad")] + [JsonProperty("delsoeknad")] + [JsonPropertyName("delsoeknad")] + public List delsoeknad { get; set; } + + } + + public class DelsoeknadType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("delAvTiltaket")] + [JsonProperty("delAvTiltaket")] + [JsonPropertyName("delAvTiltaket")] + public string delAvTiltaket { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("tillatelsedato")] + [JsonProperty("tillatelsedato")] + [JsonPropertyName("tillatelsedato")] + public string tillatelsedato { get; set; } + + [XmlElement("kommentar")] + [JsonProperty("kommentar")] + [JsonPropertyName("kommentar")] + public string kommentar { get; set; } + + [XmlElement("type")] + [JsonProperty("type")] + [JsonPropertyName("type")] + public KodeListe type { get; set; } + + [XmlElement("delsoeknadsnummer")] + [JsonProperty("delsoeknadsnummer")] + [JsonPropertyName("delsoeknadsnummer")] + public string delsoeknadsnummer { get; set; } + + } + + public class UtfallSvarListe + { + [XmlElement("utfallSvar")] + [JsonProperty("utfallSvar")] + [JsonPropertyName("utfallSvar")] + public List utfallSvar { get; set; } + + } + + public class UtfallSvarType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("utfallId")] + [JsonProperty("utfallId")] + [JsonPropertyName("utfallId")] + public string utfallId { get; set; } + + [XmlElement("utfallType")] + [JsonProperty("utfallType")] + [JsonPropertyName("utfallType")] + public KodeType utfallType { get; set; } + + [XmlElement("utloestFraSjekkpunkt")] + [JsonProperty("utloestFraSjekkpunkt")] + [JsonPropertyName("utloestFraSjekkpunkt")] + public SjekkpunktType utloestFraSjekkpunkt { get; set; } + + [XmlElement("tema")] + [JsonProperty("tema")] + [JsonPropertyName("tema")] + public KodeType tema { get; set; } + + [XmlElement("tittel")] + [JsonProperty("tittel")] + [JsonPropertyName("tittel")] + public string tittel { get; set; } + + [XmlElement("beskrivelse")] + [JsonProperty("beskrivelse")] + [JsonPropertyName("beskrivelse")] + public string beskrivelse { get; set; } + + [XmlElement("erUtfallBesvaresSenere")] + [JsonProperty("erUtfallBesvaresSenere")] + [JsonPropertyName("erUtfallBesvaresSenere")] + public bool? erUtfallBesvaresSenere { get; set; } + + [XmlElement("erUtfallBesvart")] + [JsonProperty("erUtfallBesvart")] + [JsonPropertyName("erUtfallBesvart")] + public bool? erUtfallBesvart { get; set; } + + [XmlElement("kommentar")] + [JsonProperty("kommentar")] + [JsonPropertyName("kommentar")] + public string kommentar { get; set; } + + [XmlElement("vedleggsliste")] + [JsonProperty("vedleggsliste")] + [JsonPropertyName("vedleggsliste")] + public VedleggListe vedleggsliste { get; set; } + + } + + public class SjekkpunktType + { + [XmlElement("sjekkpunktId")] + [JsonProperty("sjekkpunktId")] + [JsonPropertyName("sjekkpunktId")] + public string sjekkpunktId { get; set; } + + [XmlElement("sjekkpunktEier")] + [JsonProperty("sjekkpunktEier")] + [JsonPropertyName("sjekkpunktEier")] + public string sjekkpunktEier { get; set; } + + } + + public class VedleggListe + { + [XmlElement("vedlegg")] + [JsonProperty("vedlegg")] + [JsonPropertyName("vedlegg")] + public List vedlegg { get; set; } + + } + + public class VedleggType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("versjonsnummer")] + [JsonProperty("versjonsnummer")] + [JsonPropertyName("versjonsnummer")] + public string versjonsnummer { get; set; } + + [XmlElement("vedleggstype")] + [JsonProperty("vedleggstype")] + [JsonPropertyName("vedleggstype")] + public KodeType vedleggstype { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("versjonsdato")] + [JsonProperty("versjonsdato")] + [JsonPropertyName("versjonsdato")] + public string versjonsdato { get; set; } + + [XmlElement("filnavn")] + [JsonProperty("filnavn")] + [JsonPropertyName("filnavn")] + public string filnavn { get; set; } + + } + + public class PartType + { + [XmlElement("partstype")] + [JsonProperty("partstype")] + [JsonPropertyName("partstype")] + public KodeType partstype { get; set; } + + [XmlElement("foedselsnummer")] + [JsonProperty("foedselsnummer")] + [JsonPropertyName("foedselsnummer")] + public string foedselsnummer { get; set; } + + [XmlElement("organisasjonsnummer")] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public string organisasjonsnummer { get; set; } + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EnkelAdresseType adresse { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + [XmlElement("kontaktperson")] + [JsonProperty("kontaktperson")] + [JsonPropertyName("kontaktperson")] + public KontaktpersonType kontaktperson { get; set; } + + } + + public class EnkelAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + } + + public class KontaktpersonType + { + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("telefonnummer")] + [JsonProperty("telefonnummer")] + [JsonPropertyName("telefonnummer")] + public string telefonnummer { get; set; } + + [XmlElement("mobilnummer")] + [JsonProperty("mobilnummer")] + [JsonPropertyName("mobilnummer")] + public string mobilnummer { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + } + + public class GjenstaaendeArbeiderType + { + [XmlElement("gjenstaaendeInnenfor")] + [JsonProperty("gjenstaaendeInnenfor")] + [JsonPropertyName("gjenstaaendeInnenfor")] + public string gjenstaaendeInnenfor { get; set; } + + [XmlElement("gjenstaaendeUtenfor")] + [JsonProperty("gjenstaaendeUtenfor")] + [JsonPropertyName("gjenstaaendeUtenfor")] + public string gjenstaaendeUtenfor { get; set; } + + } + + public class SikkerhetsnivaaType + { + [XmlElement("harTilstrekkeligSikkerhet")] + [JsonProperty("harTilstrekkeligSikkerhet")] + [JsonPropertyName("harTilstrekkeligSikkerhet")] + public bool? harTilstrekkeligSikkerhet { get; set; } + + [XmlElement("typeArbeider")] + [JsonProperty("typeArbeider")] + [JsonPropertyName("typeArbeider")] + public string typeArbeider { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("utfoertInnen")] + [JsonProperty("utfoertInnen")] + [JsonPropertyName("utfoertInnen")] + public string utfoertInnen { get; set; } + + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlElement("bekreftelseInnen")] + [JsonProperty("bekreftelseInnen")] + [JsonPropertyName("bekreftelseInnen")] + public string bekreftelseInnen { get; set; } + + } +} diff --git a/testdata/Model/CSharp/XsAll/planvarsel/v2/planvarsel.cs b/testdata/Model/CSharp/XsAll/planvarsel/v2/planvarsel.cs new file mode 100644 index 00000000000..301bd919468 --- /dev/null +++ b/testdata/Model/CSharp/XsAll/planvarsel/v2/planvarsel.cs @@ -0,0 +1,522 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="Planvarsel", Namespace="https://skjema.ft.dibk.no/planvarsel/2.0")] + public class PlanvarselType + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "DIBK"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "11000"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "2.0"; + + [XmlElement("forslagsstiller")] + [JsonProperty("forslagsstiller")] + [JsonPropertyName("forslagsstiller")] + public PartType forslagsstiller { get; set; } + + [XmlElement("beroerteParter")] + [JsonProperty("beroerteParter")] + [JsonPropertyName("beroerteParter")] + public BeroertPartListe beroerteParter { get; set; } + + [XmlElement("kommunenavn")] + [JsonProperty("kommunenavn")] + [JsonPropertyName("kommunenavn")] + public string kommunenavn { get; set; } + + [XmlElement("eiendomByggested")] + [JsonProperty("eiendomByggested")] + [JsonPropertyName("eiendomByggested")] + public EiendomListe eiendomByggested { get; set; } + + [XmlElement("signatur")] + [JsonProperty("signatur")] + [JsonPropertyName("signatur")] + public SignaturType signatur { get; set; } + + [XmlElement("gjeldendePlan")] + [JsonProperty("gjeldendePlan")] + [JsonPropertyName("gjeldendePlan")] + public GjeldendePlanListe gjeldendePlan { get; set; } + + [XmlElement("plankonsulent")] + [JsonProperty("plankonsulent")] + [JsonPropertyName("plankonsulent")] + public PartType plankonsulent { get; set; } + + [XmlElement("metadata")] + [JsonProperty("metadata")] + [JsonPropertyName("metadata")] + public MetadataType metadata { get; set; } + + [XmlElement("planforslag")] + [JsonProperty("planforslag")] + [JsonPropertyName("planforslag")] + public PlanType planforslag { get; set; } + + } + + public class PartType + { + [XmlElement("partstype")] + [JsonProperty("partstype")] + [JsonPropertyName("partstype")] + public KodeType partstype { get; set; } + + [XmlElement("foedselsnummer")] + [JsonProperty("foedselsnummer")] + [JsonPropertyName("foedselsnummer")] + public string foedselsnummer { get; set; } + + [XmlElement("organisasjonsnummer")] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public string organisasjonsnummer { get; set; } + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EnkelAdresseType adresse { get; set; } + + [XmlElement("telefon")] + [JsonProperty("telefon")] + [JsonPropertyName("telefon")] + public string telefon { get; set; } + + } + + public class KodeType + { + [XmlElement("kodeverdi")] + [JsonProperty("kodeverdi")] + [JsonPropertyName("kodeverdi")] + public string kodeverdi { get; set; } + + [XmlElement("kodebeskrivelse")] + [JsonProperty("kodebeskrivelse")] + [JsonPropertyName("kodebeskrivelse")] + public string kodebeskrivelse { get; set; } + + } + + public class EnkelAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + } + + public class BeroertPartListe + { + [XmlElement("beroertpart")] + [JsonProperty("beroertpart")] + [JsonPropertyName("beroertpart")] + public List beroertpart { get; set; } + + } + + public class BeroertPartType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("partstype")] + [JsonProperty("partstype")] + [JsonPropertyName("partstype")] + public KodeType partstype { get; set; } + + [XmlElement("foedselsnummer")] + [JsonProperty("foedselsnummer")] + [JsonPropertyName("foedselsnummer")] + public string foedselsnummer { get; set; } + + [XmlElement("organisasjonsnummer")] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public string organisasjonsnummer { get; set; } + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("telefon")] + [JsonProperty("telefon")] + [JsonPropertyName("telefon")] + public string telefon { get; set; } + + [XmlElement("epost")] + [JsonProperty("epost")] + [JsonPropertyName("epost")] + public string epost { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EnkelAdresseType adresse { get; set; } + + [XmlElement("beskrivelseForVarsel")] + [JsonProperty("beskrivelseForVarsel")] + [JsonPropertyName("beskrivelseForVarsel")] + public string beskrivelseForVarsel { get; set; } + + [XmlElement("systemReferanse")] + [JsonProperty("systemReferanse")] + [JsonPropertyName("systemReferanse")] + public string systemReferanse { get; set; } + + [XmlElement("erHoeringsmyndighet")] + [JsonProperty("erHoeringsmyndighet")] + [JsonPropertyName("erHoeringsmyndighet")] + public bool? erHoeringsmyndighet { get; set; } + + [XmlElement("gjelderEiendom")] + [JsonProperty("gjelderEiendom")] + [JsonPropertyName("gjelderEiendom")] + public GjelderEiendomListe gjelderEiendom { get; set; } + + } + + public class GjelderEiendomListe + { + [XmlElement("gjeldereiendom")] + [JsonProperty("gjeldereiendom")] + [JsonPropertyName("gjeldereiendom")] + public List gjeldereiendom { get; set; } + + } + + public class EiendomType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("eiendomsidentifikasjon")] + [JsonProperty("eiendomsidentifikasjon")] + [JsonPropertyName("eiendomsidentifikasjon")] + public MatrikkelnummerType eiendomsidentifikasjon { get; set; } + + [XmlElement("adresse")] + [JsonProperty("adresse")] + [JsonPropertyName("adresse")] + public EiendommensAdresseType adresse { get; set; } + + [XmlElement("bygningsnummer")] + [JsonProperty("bygningsnummer")] + [JsonPropertyName("bygningsnummer")] + public string bygningsnummer { get; set; } + + [XmlElement("bolignummer")] + [JsonProperty("bolignummer")] + [JsonPropertyName("bolignummer")] + public string bolignummer { get; set; } + + [XmlElement("kommunenavn")] + [JsonProperty("kommunenavn")] + [JsonPropertyName("kommunenavn")] + public string kommunenavn { get; set; } + + } + + public class MatrikkelnummerType + { + [XmlElement("kommunenummer")] + [JsonProperty("kommunenummer")] + [JsonPropertyName("kommunenummer")] + public string kommunenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("gaardsnummer")] + [JsonProperty("gaardsnummer")] + [JsonPropertyName("gaardsnummer")] + public int? gaardsnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("bruksnummer")] + [JsonProperty("bruksnummer")] + [JsonPropertyName("bruksnummer")] + public int? bruksnummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("festenummer")] + [JsonProperty("festenummer")] + [JsonPropertyName("festenummer")] + public int? festenummer { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("seksjonsnummer")] + [JsonProperty("seksjonsnummer")] + [JsonPropertyName("seksjonsnummer")] + public int? seksjonsnummer { get; set; } + + } + + public class EiendommensAdresseType + { + [XmlElement("adresselinje1")] + [JsonProperty("adresselinje1")] + [JsonPropertyName("adresselinje1")] + public string adresselinje1 { get; set; } + + [XmlElement("adresselinje2")] + [JsonProperty("adresselinje2")] + [JsonPropertyName("adresselinje2")] + public string adresselinje2 { get; set; } + + [XmlElement("adresselinje3")] + [JsonProperty("adresselinje3")] + [JsonPropertyName("adresselinje3")] + public string adresselinje3 { get; set; } + + [XmlElement("postnr")] + [JsonProperty("postnr")] + [JsonPropertyName("postnr")] + public string postnr { get; set; } + + [XmlElement("poststed")] + [JsonProperty("poststed")] + [JsonPropertyName("poststed")] + public string poststed { get; set; } + + [XmlElement("landkode")] + [JsonProperty("landkode")] + [JsonPropertyName("landkode")] + public string landkode { get; set; } + + [XmlElement("gatenavn")] + [JsonProperty("gatenavn")] + [JsonPropertyName("gatenavn")] + public string gatenavn { get; set; } + + [XmlElement("husnr")] + [JsonProperty("husnr")] + [JsonPropertyName("husnr")] + public string husnr { get; set; } + + [XmlElement("bokstav")] + [JsonProperty("bokstav")] + [JsonPropertyName("bokstav")] + public string bokstav { get; set; } + + } + + public class EiendomListe + { + [XmlElement("eiendom")] + [JsonProperty("eiendom")] + [JsonPropertyName("eiendom")] + public List eiendom { get; set; } + + } + + public class SignaturType + { + [XmlElement("signaturdato")] + [JsonProperty("signaturdato")] + [JsonPropertyName("signaturdato")] + public DateTime? signaturdato { get; set; } + + [XmlElement("signertAv")] + [JsonProperty("signertAv")] + [JsonPropertyName("signertAv")] + public string signertAv { get; set; } + + [XmlElement("signertPaaVegneAv")] + [JsonProperty("signertPaaVegneAv")] + [JsonPropertyName("signertPaaVegneAv")] + public string signertPaaVegneAv { get; set; } + + } + + public class GjeldendePlanListe + { + [XmlElement("gjeldendeplan")] + [JsonProperty("gjeldendeplan")] + [JsonPropertyName("gjeldendeplan")] + public List gjeldendeplan { get; set; } + + } + + public class GjeldendePlanType + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("navn")] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public string navn { get; set; } + + [XmlElement("plantype")] + [JsonProperty("plantype")] + [JsonPropertyName("plantype")] + public KodeType plantype { get; set; } + + } + + public class MetadataType + { + [XmlElement("ftbId")] + [JsonProperty("ftbId")] + [JsonPropertyName("ftbId")] + public string ftbId { get; set; } + + [XmlElement("hovedinnsendingsnummer")] + [JsonProperty("hovedinnsendingsnummer")] + [JsonPropertyName("hovedinnsendingsnummer")] + public string hovedinnsendingsnummer { get; set; } + + [XmlElement("klartForSigneringFraSluttbrukersystem")] + [JsonProperty("klartForSigneringFraSluttbrukersystem")] + [JsonPropertyName("klartForSigneringFraSluttbrukersystem")] + public bool? klartForSigneringFraSluttbrukersystem { get; set; } + + [XmlElement("fraSluttbrukersystem")] + [JsonProperty("fraSluttbrukersystem")] + [JsonPropertyName("fraSluttbrukersystem")] + public string fraSluttbrukersystem { get; set; } + + } + + public class PlanType + { + [XmlElement("plannavn")] + [JsonProperty("plannavn")] + [JsonPropertyName("plannavn")] + public string plannavn { get; set; } + + [XmlElement("arealplanId")] + [JsonProperty("arealplanId")] + [JsonPropertyName("arealplanId")] + public string arealplanId { get; set; } + + [XmlElement("hjemmesidePlanforslag")] + [JsonProperty("hjemmesidePlanforslag")] + [JsonPropertyName("hjemmesidePlanforslag")] + public string hjemmesidePlanforslag { get; set; } + + [XmlElement("kravKonsekvensUtredning")] + [JsonProperty("kravKonsekvensUtredning")] + [JsonPropertyName("kravKonsekvensUtredning")] + public bool? kravKonsekvensUtredning { get; set; } + + [XmlElement("planHensikt")] + [JsonProperty("planHensikt")] + [JsonPropertyName("planHensikt")] + public string planHensikt { get; set; } + + [XmlElement("fristForInnspill")] + [JsonProperty("fristForInnspill")] + [JsonPropertyName("fristForInnspill")] + public DateTime? fristForInnspill { get; set; } + + [XmlElement("hjemmesidePlanprogram")] + [JsonProperty("hjemmesidePlanprogram")] + [JsonPropertyName("hjemmesidePlanprogram")] + public string hjemmesidePlanprogram { get; set; } + + [XmlElement("plantype")] + [JsonProperty("plantype")] + [JsonPropertyName("plantype")] + public KodeType plantype { get; set; } + + [XmlElement("begrunnelseKU")] + [JsonProperty("begrunnelseKU")] + [JsonPropertyName("begrunnelseKU")] + public string begrunnelseKU { get; set; } + + [XmlElement("kommunensSaksnummer")] + [JsonProperty("kommunensSaksnummer")] + [JsonPropertyName("kommunensSaksnummer")] + public SaksnummerType kommunensSaksnummer { get; set; } + + [XmlElement("saksgangOgMedvirkning")] + [JsonProperty("saksgangOgMedvirkning")] + [JsonPropertyName("saksgangOgMedvirkning")] + public string saksgangOgMedvirkning { get; set; } + + } + + public class SaksnummerType + { + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("saksaar")] + [JsonProperty("saksaar")] + [JsonPropertyName("saksaar")] + public int? saksaar { get; set; } + + [Range(Int32.MinValue,Int32.MaxValue)] + [XmlElement("sakssekvensnummer")] + [JsonProperty("sakssekvensnummer")] + [JsonPropertyName("sakssekvensnummer")] + public int? sakssekvensnummer { get; set; } + + } +} diff --git a/testdata/Model/XmlSchema/XsAll/ferdigattest/v4/ferdigattest.xsd b/testdata/Model/XmlSchema/XsAll/ferdigattest/v4/ferdigattest.xsd new file mode 100644 index 00000000000..f671ec00965 --- /dev/null +++ b/testdata/Model/XmlSchema/XsAll/ferdigattest/v4/ferdigattest.xsd @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testdata/Model/XmlSchema/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.xsd b/testdata/Model/XmlSchema/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.xsd new file mode 100644 index 00000000000..adb62a8ed2b --- /dev/null +++ b/testdata/Model/XmlSchema/XsAll/igangsettingstillatelse/v4/igangsettingstillatelse.xsd @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testdata/Model/XmlSchema/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.xsd b/testdata/Model/XmlSchema/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.xsd new file mode 100644 index 00000000000..351e1405378 --- /dev/null +++ b/testdata/Model/XmlSchema/XsAll/midlertidigbrukstillatelse/v4/midlertidigbrukstillatelse.xsd @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testdata/Model/XmlSchema/XsAll/planvarsel/v2/planvarsel.xsd b/testdata/Model/XmlSchema/XsAll/planvarsel/v2/planvarsel.xsd new file mode 100644 index 00000000000..2d7c10672bb --- /dev/null +++ b/testdata/Model/XmlSchema/XsAll/planvarsel/v2/planvarsel.xsd @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +