Skip to content

Commit

Permalink
Ensure the vocabulary analyzer is created from the current context.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwadams committed Nov 20, 2024
1 parent 461b34a commit 55160c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Solutions/Corvus.Json.Validator/JsonSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public readonly struct JsonSchema
""";

private static readonly PrepopulatedDocumentResolver MetaschemaDocumentResolver = CreateMetaschemaDocumentResolver();
private static readonly VocabularyRegistry VocabularyRegistry = RegisterVocabularies(MetaschemaDocumentResolver);
private static readonly ConcurrentDictionary<string, ValidateCallback> CachedSchema = [];

#if NET8_0_OR_GREATER
Expand Down Expand Up @@ -170,7 +169,9 @@ public ValidationContext Validate(JsonElement jsonElement, ValidationLevel level

private static JsonSchema FromCore(string jsonSchemaUri, IDocumentResolver documentResolver, IVocabulary fallbackVocabulary, bool alwaysAssertFormat)
{
JsonSchemaTypeBuilder typeBuilder = new(documentResolver, VocabularyRegistry);
VocabularyRegistry vocabularyRegistry = RegisterVocabularies(documentResolver);

JsonSchemaTypeBuilder typeBuilder = new(documentResolver, vocabularyRegistry);

TypeDeclaration rootType =
typeBuilder.AddTypeDeclarations(
Expand Down

0 comments on commit 55160c9

Please sign in to comment.