Skip to content

Commit

Permalink
Merge pull request #709 from gregsdennis/schema/builder-extension-update
Browse files Browse the repository at this point in the history
Schema/builder extension update
  • Loading branch information
gregsdennis committed Apr 18, 2024
2 parents f9e9cab + f0e1db9 commit 5a9c156
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions JsonSchema/JsonSchema.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<PackageProjectUrl>https://github.com/gregsdennis/json-everything</PackageProjectUrl>
<RepositoryUrl>https://github.com/gregsdennis/json-everything</RepositoryUrl>
<PackageTags>json-schema validation schema json</PackageTags>
<Version>6.0.7</Version>
<FileVersion>6.0.7.0</FileVersion>
<Version>6.1.0</Version>
<FileVersion>6.1.0.0</FileVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<AssemblyName>JsonSchema.Net</AssemblyName>
Expand Down
12 changes: 6 additions & 6 deletions JsonSchema/JsonSchemaExtensions.KeywordAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the schemas in `allOf` if the keyword exists.
/// </summary>
public static IReadOnlyCollection<JsonSchema>? GetAllOf(this JsonSchema schema)
public static IReadOnlyList<JsonSchema>? GetAllOf(this JsonSchema schema)
{
return schema.TryGetKeyword<AllOfKeyword>(AllOfKeyword.Name, out var k) ? k.Schemas : null;
}
Expand All @@ -45,7 +45,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the schemas in `anyOf` if the keyword exists.
/// </summary>
public static IReadOnlyCollection<JsonSchema>? GetAnyOf(this JsonSchema schema)
public static IReadOnlyList<JsonSchema>? GetAnyOf(this JsonSchema schema)
{
return schema.TryGetKeyword<AnyOfKeyword>(AnyOfKeyword.Name, out var k) ? k.Schemas : null;
}
Expand Down Expand Up @@ -197,7 +197,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the values in `examples` if the keyword exists.
/// </summary>
public static IReadOnlyCollection<JsonNode?>? GetExamples(this JsonSchema schema)
public static IReadOnlyList<JsonNode?>? GetExamples(this JsonSchema schema)
{
return schema.TryGetKeyword<ExamplesKeyword>(ExamplesKeyword.Name, out var k) ? k.Values : null;
}
Expand Down Expand Up @@ -253,7 +253,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the schemas in `items` if the keyword exists and is an array of schemas.
/// </summary>
public static IReadOnlyCollection<JsonSchema>? GetItemsArrayForm(this JsonSchema schema)
public static IReadOnlyList<JsonSchema>? GetItemsArrayForm(this JsonSchema schema)
{
return schema.TryGetKeyword<ItemsKeyword>(ItemsKeyword.Name, out var k) ? k.ArraySchemas : null;
}
Expand Down Expand Up @@ -357,7 +357,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the schemas in `oneOf` if the keyword exists.
/// </summary>
public static IReadOnlyCollection<JsonSchema>? GetOneOf(this JsonSchema schema)
public static IReadOnlyList<JsonSchema>? GetOneOf(this JsonSchema schema)
{
return schema.TryGetKeyword<OneOfKeyword>(OneOfKeyword.Name, out var k) ? k.Schemas : null;
}
Expand All @@ -381,7 +381,7 @@ public static partial class JsonSchemaExtensions
/// <summary>
/// Gets the schemas in `prefixItems` if the keyword exists.
/// </summary>
public static IReadOnlyCollection<JsonSchema>? GetPrefixItems(this JsonSchema schema)
public static IReadOnlyList<JsonSchema>? GetPrefixItems(this JsonSchema schema)
{
return schema.TryGetKeyword<PrefixItemsKeyword>(PrefixItemsKeyword.Name, out var k) ? k.ArraySchemas : null;
}
Expand Down
4 changes: 4 additions & 0 deletions tools/ApiDocsGenerator/release-notes/rn-json-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ title: JsonSchema.Net
icon: fas fa-tag
order: "09.01"
---
# [6.1.0](https://github.com/gregsdennis/json-everything/pull/709) {#release-schema-6.1.0}

[#704](https://github.com/gregsdennis/json-everything/issues/704) - Several builder extension return types expanded from `IReadOnlyCollection<T>` to `IReadOnlyList<T>`. Thanks to [@SGStino](https://github.com/SGStino) for identifying and implementing this.

# [6.0.7](https://github.com/gregsdennis/json-everything/pull/698) {#release-schema-6.0.7}

[#697](https://github.com/gregsdennis/json-everything/issues/697) - `allOf`, `anyOf`, `oneOf`, and `prefixItems` all require at least one subschema, but deserialization of these keywords didn't enforce this. Fix will throw `ArgumentException` when attempting to deserialize empty subschema sets. Thanks to [@Era-cell](https://github.com/Era-cell) for reporting this.
Expand Down

0 comments on commit 5a9c156

Please sign in to comment.