Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort array-based ref-resolvable schema by array order. #297

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private static Predicate<JsonAny> CreateDraft201909IsExplicitArrayType()
}

/// <summary>
/// Creates the predicate that determiens whether this schema represents a simple type.
/// Creates the predicate that determines whether this schema represents a simple type.
/// </summary>
/// <returns>A predicate that returns <see langword="true"/> if the schema is a simple type.</returns>
private static Predicate<JsonAny> CreateDraft201909IsSimpleType()
Expand Down Expand Up @@ -399,7 +399,7 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.AllOf.IsNotUndefined())
{
foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => 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);
}
Expand All @@ -417,17 +417,17 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.DependentSchemas.IsNotUndefined())
{
foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).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")).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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private static Predicate<JsonAny> CreateDraft202012IsExplicitArrayType()
}

/// <summary>
/// Creates the predicate that determiens whether this Schema() represents a simple type.
/// Creates the predicate that determines whether this Schema() represents a simple type.
/// </summary>
/// <returns><see langword="true"/> if the Schema() is a simple type.</returns>
private static Predicate<JsonAny> CreateDraft202012IsSimpleType()
Expand Down Expand Up @@ -384,7 +384,7 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.AllOf.IsNotUndefined())
{
foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => 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);
}
Expand All @@ -402,17 +402,17 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.DependentSchemas.IsNotUndefined())
{
foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependentSchemas")).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")).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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private static Predicate<JsonAny> CreateDraft6IsExplicitArrayType()
}

/// <summary>
/// Creates the predicate that determiens whether this schema represents a simple type.
/// Creates the predicate that determines whether this schema represents a simple type.
/// </summary>
/// <returns><see langword="true"/> if the schema is a simple type.</returns>
private static Predicate<JsonAny> CreateDraft6IsSimpleType()
Expand Down Expand Up @@ -348,17 +348,17 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.AllOf.IsNotUndefined())
{
foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => 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);
}
}

if (schema.Dependencies.IsNotUndefined())
{
foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private static Predicate<JsonAny> CreateDraft7IsExplicitArrayType()
}

/// <summary>
/// Creates the predicate that determiens whether this schema represents a simple type.
/// Creates the predicate that determines whether this schema represents a simple type.
/// </summary>
/// <returns><see langword="true"/> if the schema is a simple type.</returns>
private static Predicate<JsonAny> CreateDraft7IsSimpleType()
Expand Down Expand Up @@ -351,7 +351,7 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.AllOf.IsNotUndefined())
{
foreach (TypeDeclaration allOfTypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => 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);
}
Expand All @@ -369,9 +369,9 @@ private static Action<IPropertyBuilder, TypeDeclaration, TypeDeclaration, HashSe

if (schema.Dependencies.IsNotUndefined())
{
foreach (TypeDeclaration dependentypeDeclaration in source.RefResolvablePropertyDeclarations.Where(k => k.Key.StartsWith("#/dependencies")).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);
}
}

Expand Down
Loading