From b8747da9792d629a02589d658e7326249427b2b6 Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Tue, 27 Feb 2024 09:11:15 +0000 Subject: [PATCH 1/2] Stabilise the ordering of the property generation for allOf, dependencies and dependentSchemas. --- .../JsonSchemaHelpers.Draft201909.cs | 6 +++--- .../JsonSchemaHelpers.Draft202012.cs | 6 +++--- .../JsonSchemaHelpers.Draft6.cs | 4 ++-- .../JsonSchemaHelpers.Draft7.cs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs b/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs index f6d69eb59..7c9eee6b3 100644 --- a/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs +++ b/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs @@ -399,7 +399,7 @@ private static Action k.Key.StartsWith("#/allOf")).Select(k => k.Value)) + foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/allOf")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(allOfTypeDeclaration, target, typesVisited, treatRequiredAsOptional); } @@ -417,7 +417,7 @@ private static Action k.Key.StartsWith("#/dependentSchemas")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } @@ -425,7 +425,7 @@ private static Action k.Key.StartsWith("#/dependencies")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } diff --git a/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs b/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs index 57508bfb4..becf32a4e 100644 --- a/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs +++ b/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs @@ -384,7 +384,7 @@ private static Action k.Key.StartsWith("#/allOf")).Select(k => k.Value)) + foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/allOf")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(allOfTypeDeclaration, target, typesVisited, treatRequiredAsOptional); } @@ -402,7 +402,7 @@ private static Action k.Key.StartsWith("#/dependentSchemas")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } @@ -410,7 +410,7 @@ private static Action k.Key.StartsWith("#/dependencies")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } diff --git a/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs b/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs index 71b135d49..031221c0d 100644 --- a/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs +++ b/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs @@ -348,7 +348,7 @@ private static Action k.Key.StartsWith("#/allOf")).Select(k => k.Value)) + foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/allOf")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(allOfTypeDeclaration, target, typesVisited, treatRequiredAsOptional); } @@ -356,7 +356,7 @@ private static Action k.Key.StartsWith("#/dependencies")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } diff --git a/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs b/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs index 3f74a51e9..ae48087c7 100644 --- a/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs +++ b/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs @@ -351,7 +351,7 @@ private static Action k.Key.StartsWith("#/allOf")).Select(k => k.Value)) + foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/allOf")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(allOfTypeDeclaration, target, typesVisited, treatRequiredAsOptional); } @@ -369,7 +369,7 @@ private static Action k.Key.StartsWith("#/dependencies")).Select(k => k.Value)) + foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); } From 76984388b03a2ef97f19ddcb08dc84e4776b78e1 Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Tue, 27 Feb 2024 09:29:01 +0000 Subject: [PATCH 2/2] Fixed typos. --- .../JsonSchemaHelpers.Draft201909.cs | 10 +++++----- .../JsonSchemaHelpers.Draft202012.cs | 10 +++++----- .../JsonSchemaHelpers.Draft6.cs | 6 +++--- .../JsonSchemaHelpers.Draft7.cs | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs b/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs index 7c9eee6b3..2639e343d 100644 --- a/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs +++ b/Solutions/Corvus.Json.CodeGeneration.201909/Corvus.Json.CodeGeneration.Draft201909/JsonSchemaHelpers.Draft201909.cs @@ -325,7 +325,7 @@ private static Predicate CreateDraft201909IsExplicitArrayType() } /// - /// Creates the predicate that determiens whether this schema represents a simple type. + /// Creates the predicate that determines whether this schema represents a simple type. /// /// A predicate that returns if the schema is a simple type. private static Predicate CreateDraft201909IsSimpleType() @@ -417,17 +417,17 @@ private static Action k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } } if (schema.Dependencies.IsNotUndefined()) { - foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } } diff --git a/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs b/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs index becf32a4e..b08f3691b 100644 --- a/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs +++ b/Solutions/Corvus.Json.CodeGeneration.202012/Corvus.Json.CodeGeneration.Draft202012/JsonSchemaHelpers.Draft202012.cs @@ -310,7 +310,7 @@ private static Predicate CreateDraft202012IsExplicitArrayType() } /// - /// Creates the predicate that determiens whether this Schema() represents a simple type. + /// Creates the predicate that determines whether this Schema() represents a simple type. /// /// if the Schema() is a simple type. private static Predicate CreateDraft202012IsSimpleType() @@ -402,17 +402,17 @@ private static Action k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } } if (schema.Dependencies.IsNotUndefined()) { - foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } } diff --git a/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs b/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs index 031221c0d..071cac7c6 100644 --- a/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs +++ b/Solutions/Corvus.Json.CodeGeneration.6/Corvus.Json.CodeGeneration.Draft6/JsonSchemaHelpers.Draft6.cs @@ -274,7 +274,7 @@ private static Predicate CreateDraft6IsExplicitArrayType() } /// - /// Creates the predicate that determiens whether this schema represents a simple type. + /// Creates the predicate that determines whether this schema represents a simple type. /// /// if the schema is a simple type. private static Predicate CreateDraft6IsSimpleType() @@ -356,9 +356,9 @@ private static Action k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } } diff --git a/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs b/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs index ae48087c7..1576d4e2d 100644 --- a/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs +++ b/Solutions/Corvus.Json.CodeGeneration.7/Corvus.Json.CodeGeneration.Draft7/JsonSchemaHelpers.Draft7.cs @@ -277,7 +277,7 @@ private static Predicate CreateDraft7IsExplicitArrayType() } /// - /// Creates the predicate that determiens whether this schema represents a simple type. + /// Creates the predicate that determines whether this schema represents a simple type. /// /// if the schema is a simple type. private static Predicate CreateDraft7IsSimpleType() @@ -369,9 +369,9 @@ private static Action k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) + foreach (TypeDeclaration dependentTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).OrderBy(k => k.Key).Select(k => k.Value)) { - builder.FindAndBuildProperties(dependentypeDeclaration, target, typesVisited, true); + builder.FindAndBuildProperties(dependentTypeDeclaration, target, typesVisited, true); } }