Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c9b1b9
Add Corvus.Json.CodeGeneration.OpenApi31
StephenHodgson Jul 7, 2025
db4c7b3
cleanup
StephenHodgson Jul 7, 2025
c5043a3
docs
StephenHodgson Jul 7, 2025
1cb97a4
more cleanup
StephenHodgson Jul 8, 2025
1b70105
remove duplicate BinaryJsonNumber implicit equality declarations
StephenHodgson Jul 8, 2025
97e42bf
updated package dependencies
StephenHodgson Jul 8, 2025
df55e31
Merge branch 'upstream'
StephenHodgson Jul 8, 2025
e910975
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 8, 2025
ff7b839
Update Solutions/Corvus.Json.CodeGeneration/Corvus.Json.CodeGeneratio…
StephenHodgson Jul 8, 2025
abf8dbd
Update Solutions/Corvus.Json.CodeGenerator/ValidateDocumentCommand.cs
StephenHodgson Jul 8, 2025
513798d
use Draft202012 vocabulary
StephenHodgson Jul 8, 2025
7b5af81
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 8, 2025
f0b8c41
fix ambiguous equality checks
StephenHodgson Jul 9, 2025
8cfd7e6
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 9, 2025
dcba0b4
remove more ambiguous equality checks
StephenHodgson Jul 9, 2025
d979c7b
fix ambiguous equality operators (again?)
StephenHodgson Jul 9, 2025
6949c4c
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 9, 2025
5d772e4
sort operators
StephenHodgson Jul 9, 2025
f137c42
revert changes
StephenHodgson Jul 9, 2025
9bb1479
remove ambiguous equality operators
StephenHodgson Jul 9, 2025
3cbcb25
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 9, 2025
211ebbe
revert TryGetMetadata return value
StephenHodgson Jul 10, 2025
90a5808
remove whitespace line
StephenHodgson Jul 10, 2025
a258b94
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 10, 2025
f3307d3
integrate drafts 6, 7
StephenHodgson Jul 11, 2025
503ff0f
Example code change to remove double ;;
mwadams Jul 11, 2025
72a51c4
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 11, 2025
3e5d354
Merge branch 'upstream' into refactor-metaschema-dependencies
StephenHodgson Jul 14, 2025
732a41f
Merge branch 'main' into refactor-metaschema-dependencies
StephenHodgson Jul 26, 2025
38ed36e
package locks
StephenHodgson Jul 26, 2025
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
315 changes: 287 additions & 28 deletions Solutions/Corvus.Json.Benchmarking/packages.lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.Draft201909\Corvus.Json.JsonSchema.Draft201909.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.Draft202012\Corvus.Json.JsonSchema.Draft202012.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.Draft4\Corvus.Json.JsonSchema.Draft4.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.Draft6\Corvus.Json.JsonSchema.Draft6.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.Draft7\Corvus.Json.JsonSchema.Draft7.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
<ProjectReference Include="..\Corvus.Json.CodeGeneration.CSharp\Corvus.Json.CodeGeneration.CSharp.csproj" />
<ProjectReference Include="..\Corvus.Json.CodeGeneration.HttpClientDocumentResolver\Corvus.Json.CodeGeneration.HttpClientDocumentResolver.csproj" />
<ProjectReference Include="..\Corvus.Json.CodeGeneration.OpenApi30\Corvus.Json.CodeGeneration.OpenApi30.csproj" />
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.ExtendedTypes\Corvus.Json.ExtendedTypes.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -77,9 +75,6 @@
<EmbeddedResource Include="metaschema\draft2020-12\meta\unevaluated.json" />
<EmbeddedResource Include="metaschema\draft2020-12\meta\validation.json" />
<EmbeddedResource Include="metaschema\draft2020-12\schema.json" />
<EmbeddedResource Include="metaschema\draft4\schema.json" />
<EmbeddedResource Include="metaschema\draft6\schema.json" />
<EmbeddedResource Include="metaschema\draft7\schema.json" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ public async ValueTask<IReadOnlyCollection<GeneratedCodeFile>> GenerateFilesAsyn

private static PrepopulatedDocumentResolver CreateMetaschemaDocumentResolver()
{
var result = new PrepopulatedDocumentResolver();
result.AddMetaschema();
return result;
PrepopulatedDocumentResolver documentResolver = new();

// Add support for the meta schemas we are interested in.
documentResolver.AddDocument(JsonSchema.Draft4.MetaSchema.Instance);
documentResolver.AddMetaschema();

return documentResolver;
}

private static VocabularyRegistry RegisterVocabularies(IDocumentResolver documentResolver)
Expand All @@ -136,8 +140,6 @@ private static VocabularyRegistry RegisterVocabularies(IDocumentResolver documen

private static CompoundDocumentResolver CompoundWithMetaschemaResolver(IDocumentResolver metaschemaDocumentResolver, IDocumentResolver additionalResolver)
{
return new(
additionalResolver,
metaschemaDocumentResolver);
return new(additionalResolver, metaschemaDocumentResolver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ internal static class Metaschema
/// <summary>
/// Add the standard metaschema to the document resolver.
/// </summary>
/// <param name="documentResolver">The document resovler to which to apply the metaschema.</param>
/// <param name="documentResolver">The document resolver to which to apply the metaschema.</param>
/// <returns>A reference to the <see cref="IDocumentResolver"/> after the operation has completed.</returns>
internal static IDocumentResolver AddMetaschema(this IDocumentResolver documentResolver)
{
var assembly = Assembly.GetAssembly(typeof(Metaschema));

Debug.Assert(assembly is not null, "The assembly containing this type must exist");

documentResolver.AddDocument(
"http://json-schema.org/draft-04/schema",
JsonDocument.Parse(ReadResource(assembly, "metaschema.draft4.schema.json")));

documentResolver.AddDocument(
"http://json-schema.org/draft-06/schema",
JsonDocument.Parse(ReadResource(assembly, "metaschema.draft6.schema.json")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration.202012\Corvus.Json.CodeGeneration.202012.csproj" />
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public bool AddDocument(string uri, JsonDocument document)
return this.documents.TryAdd(uri, document);
}

/// <inheritdoc/>
public bool AddDocument(IMetaSchema metaSchema)
=> this.AddDocument(metaSchema.Uri, metaSchema.Document);

/// <inheritdoc/>
public async ValueTask<JsonElement?> TryResolve(JsonReference reference)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.OpenApi30\Corvus.Json.JsonSchema.OpenApi30.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ItemGroup>
<ProjectReference Include="..\Corvus.Json.CodeGeneration.202012\Corvus.Json.CodeGeneration.202012.csproj" />
<ProjectReference Include="..\Corvus.Json.CodeGeneration\Corvus.Json.CodeGeneration.csproj" />
<ProjectReference Include="..\Corvus.Json.JsonSchema.OpenApi31\Corvus.Json.JsonSchema.OpenApi31.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

using System;
using System.Text.Json;

namespace Corvus.Json.CodeGeneration.DocumentResolvers;
Expand Down Expand Up @@ -29,6 +30,10 @@ public bool AddDocument(string uri, JsonDocument document)
return this.resolver.AddDocument(uri, document);
}

/// <inheritdoc/>
public bool AddDocument(IMetaSchema metaSchema)
=> this.AddDocument(metaSchema.Uri, metaSchema.Document);

/// <inheritdoc/>
public void Dispose()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

using System;
using System.Text.Json;

namespace Corvus.Json.CodeGeneration;
Expand Down Expand Up @@ -32,6 +33,10 @@ public bool AddDocument(string uri, JsonDocument document)
return this.documents.TryAdd(uri, document);
}

/// <inheritdoc/>
public bool AddDocument(IMetaSchema metaSchema)
=> this.AddDocument(metaSchema.Uri, metaSchema.Document);

/// <inheritdoc/>
public async ValueTask<JsonElement?> TryResolve(JsonReference reference)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public bool AddDocument(string uri, JsonDocument document)
return this.documents.TryAdd(uri, document);
}

/// <inheritdoc/>
public bool AddDocument(IMetaSchema metaSchema)
=> this.AddDocument(metaSchema.Uri, metaSchema.Document);

/// <inheritdoc/>
public async ValueTask<JsonElement?> TryResolve(JsonReference reference)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public interface IDocumentResolver : IDisposable
/// <returns><c>True</c> if the document was added, otherwise false.</returns>
bool AddDocument(string uri, JsonDocument document);

/// <summary>
/// Adds an existing document to the cache.
/// </summary>
/// <param name="metaSchema">The <see cref="IMetaSchema"/> document to add.</param>
/// <returns><c>True</c> if the document was added, otherwise false.</returns>
bool AddDocument(IMetaSchema metaSchema);

/// <summary>
/// Reset the document resolver.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

using System;
using System.Text.Json;

namespace Corvus.Json;
Expand Down Expand Up @@ -31,6 +32,10 @@ public bool AddDocument(string uri, JsonDocument document)
#endif
}

/// <inheritdoc/>
public bool AddDocument(IMetaSchema metaSchema)
=> this.AddDocument(metaSchema.Uri, metaSchema.Document);

/// <inheritdoc/>
public ValueTask<JsonElement?> TryResolve(JsonReference reference)
{
Expand Down
Loading
Loading