Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
cd8eb02
Merge pull request #21181 from ppekrol/feature/json-schema
ppekrol Aug 13, 2025
4fc0135
RavenDB-22142 Base for schema validation with basic rules
haludi Oct 25, 2024
46d9153
RavenDB-22142 Enum rule validator
haludi Nov 1, 2024
d618737
RavenDB-22142 Constant validator
haludi Nov 5, 2024
5514d20
RavenDB-22142 Boolean validation
haludi Nov 5, 2024
2ed19bc
RavenDB-22142 Validate null
haludi Nov 5, 2024
3e05c38
RavenDB-22142 Handle PatternProperties
haludi Nov 28, 2024
8fd23f2
RavenDB-22142 Support additionalProperties
haludi Nov 29, 2024
6a59ace
RavenDB-22142 Fix path
haludi Nov 29, 2024
08f3258
RavenDB-22142 Support restriction on nested object
haludi Nov 29, 2024
a0e0bc5
RavenDB-22142 Add errors for invalid schema
haludi Dec 10, 2024
765fe30
RavenDB-22142 Move 'required' to its own validator
haludi Dec 30, 2024
b4539ec
RavenDB-22142 Change the tests to assert in parallel
haludi Dec 31, 2024
e86d3bd
RavenDB-22142
haludi Dec 31, 2024
b356648
RavenDB-22142 Property Names Validator
haludi Jan 1, 2025
c23b50b
RavenDB-22142 Validate array type
haludi Jan 1, 2025
dad03eb
RavenDB-22142 Add uniqueItems and automatically find validators
haludi Jan 3, 2025
7313b2c
RavenDB-22142 Move rules name to const
haludi Jan 3, 2025
556ef44
RavenDB-22142 Validate array
haludi Jan 9, 2025
7d5a3d2
RavenDB-22142 Allow to validate without error message building
haludi Jan 9, 2025
dd35fbb
RavenDB-22142 Move Path to ErrorBuilder
haludi Jan 9, 2025
9cca022
RavenDB-22142 Array contains rule validation
haludi Jan 10, 2025
22ee787
RavenDB-22142 Move contains rule validation to its own validator
haludi Jan 10, 2025
074784b
RavenDB-22142 Add 'minContains' & 'maxContains'
haludi Jan 10, 2025
d198ee9
RavenDB-22142 dependentRequired
haludi Jan 17, 2025
fd0ee48
RavenDB-22142 Conditional Schema
haludi Jan 20, 2025
b48dc26
RavenDB-22142 Move init code to factory
haludi Jan 20, 2025
9d6c0ae
RavenDB-22142 dependent schema
haludi Feb 28, 2025
05521cb
RavenDB-22142 Schema path
haludi Mar 8, 2025
8389e5c
RavenDB-22142 Reduce error message allocation
haludi Mar 14, 2025
442441f
RavenDB-22142 RentedBuffer
haludi Mar 17, 2025
a6ab409
RavenDB-22142 `Not` validator
haludi Mar 17, 2025
c3c9cdd
RavenDB-22142 Reference Schema
haludi Apr 2, 2025
c981023
RavenDB-22142 Minor refactor SchemaRuleValidator definition
haludi Apr 3, 2025
b2220b2
RavenDB-22142 Unmanaged buffers for errors
haludi Apr 15, 2025
40dced2
RavenDB-22142 Fix exceptions type in ErrorBufferStreamWrapper
haludi Apr 16, 2025
f92ce56
RavenDB-22142 Use direct value
haludi Apr 17, 2025
0afd630
RavenDB-22142 Arrange untyped validators
haludi Apr 18, 2025
3f2b429
RavenDB-22142 Ref schema
haludi Apr 18, 2025
a17f700
RavenDB-22142 AllOf validator
haludi Apr 18, 2025
053e6ac
RavenDB-22142 oneOf validator
haludi Apr 18, 2025
c8d8742
RavenDB-22142 anyOf validator
haludi Apr 18, 2025
3086f02
RavenDB-24253 - add the ConfigureSchemaValidationOperation and GetSch…
grisha-kotler May 30, 2025
76e0b84
RavenDB-24254 - connect the SchemaValidator to the DocumentsStorage
grisha-kotler May 30, 2025
9f4ffcd
RavenDB-24254 - update tests
grisha-kotler May 30, 2025
07a586a
RavenDB-24254 - skip validation when the document comes from replicat…
grisha-kotler May 30, 2025
a08d466
RavenDB-24254 - update endpoints
grisha-kotler May 30, 2025
4722464
RavenDB-24254 - add missing command to JsonDeserializationCluster
grisha-kotler May 30, 2025
7b5f25e
RavenDB-22142 Avoid using context concurrently when comparing, fix La…
haludi May 30, 2025
6fc101d
RavenDB-24254 - update DatabaseRecordItemType
grisha-kotler May 31, 2025
50eb509
RavenDB-24253 - update smuggler
grisha-kotler May 31, 2025
9d6195f
RavenDB-24254 - fix NRE during restore
grisha-kotler May 31, 2025
4045474
RavenDB-24254 - update cluster command version
grisha-kotler May 31, 2025
16a7f60
RavenDB-24254 - fix test
grisha-kotler May 31, 2025
aa076f8
RavenDB-22142 Use RavenFact
haludi Jun 2, 2025
b5a9096
RavenDB-24253 - set SchemaDefinition to string
grisha-kotler Jun 3, 2025
99fdca0
RavenDB-24253 - fix NRE
grisha-kotler Jun 3, 2025
9307044
RavenDB-24253 - add a basic test
grisha-kotler Jun 3, 2025
e40a203
RavenDB-24253 - add support for additionalProperties - @metadata is a…
grisha-kotler Jun 5, 2025
95210b3
RavenDB-24254 - don't throw an exception if we failed to parse the sc…
grisha-kotler Jun 23, 2025
6a8ca6c
RavenDB-24254 - add the SchemaValidationException
grisha-kotler Jun 23, 2025
8b98458
RavenDB-24319 Add test to validation schema validation across data fl…
haludi Jun 24, 2025
2e15ca9
RavenDB-24319 Modify restore, export/import database record test to i…
haludi Jun 24, 2025
8efb846
RavenDB-24319 Fix tests
haludi Jun 25, 2025
b15c633
RavenDB-22142 Explicit case-sensitive for schema references
haludi Jun 30, 2025
817e561
RavenDB-22142 Use FrozenDictionary for read-only validator dictionary
haludi Jun 30, 2025
31f0a79
RavenDB-22142 Properly dispose buffers
haludi Jul 9, 2025
07d6bbe
RavenDB-22142 HashSet, fix names and scopes, AdditionalProperties & r…
haludi Jul 9, 2025
45e65f5
RavenDB-22142 Move the SchemaValidation folder inside the Documents f…
haludi Jul 9, 2025
dfce837
RavenDB-22142 Back property for ValidatorsPerCollection
haludi Jul 10, 2025
7baa577
RavenDB-22142 Fix tests
haludi Aug 15, 2025
c29c8b1
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Aug 19, 2025
d4cafc2
Merge pull request #21222 from ppekrol/feature/json-schema
ppekrol Aug 19, 2025
ad8e0f2
RavenDB-22142 Remove unnecessary Flush and SchemaValidator -> SchemaD…
haludi Sep 2, 2025
2208a70
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Sep 5, 2025
0e31180
Merge pull request #21342 from ppekrol/feature/json-schema
ppekrol Sep 5, 2025
cc00735
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Sep 24, 2025
88df25a
Merge pull request #21466 from ppekrol/feature/json-schema
ppekrol Sep 24, 2025
3659e39
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Oct 3, 2025
9b8711c
Merge pull request #21521 from ppekrol/feature/json-schema
ppekrol Oct 3, 2025
7342fb6
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Oct 14, 2025
16e6288
Merge pull request #21577 from ppekrol/feature/json-schema
ppekrol Oct 14, 2025
d994f1b
RavenDB-24346 feat (document schema) - add Document Schema settings p…
M4xymm Sep 19, 2025
deed17d
RavenDB-24346 feat (document schema) - implement document schema mana…
M4xymm Sep 19, 2025
b4d0065
RavenDB-24346 feat (document schema) - restructure components into pa…
M4xymm Sep 23, 2025
460e773
RavenDB-24346 refactor (document schema) - remove unused `license` va…
M4xymm Sep 23, 2025
6031320
RavenDB-24346 feat (document schema) - integrate `setValue` in `AceEd…
M4xymm Sep 23, 2025
dbb1f5a
RavenDB-24346 feat (document schema) - add unit tests for DocumentSch…
M4xymm Sep 23, 2025
7b2f4b3
RavenDB-24346 Fix AceEditor onValidate
kalczur Sep 24, 2025
e9df34b
RavenDB-24346 feat (document schema) - Fixed Cr comments
M4xymm Sep 25, 2025
cc74fdd
RavenDB-24346 feat (document schema) - Fixed tests
M4xymm Sep 25, 2025
3d9a411
RavenDB-24346 feat (document schema) - eslint fix
M4xymm Sep 25, 2025
66c442b
RavenDB-24346 Add document-schema icon
mateuszbartosik Sep 25, 2025
b19889a
RavenDB-24346 feat (document schema) - fixed getSchemaValidationComma…
M4xymm Sep 29, 2025
6717c32
RavenDB-24346 feat (document schema) - Fixed filtering, added more st…
M4xymm Sep 29, 2025
2a79e2f
RavenDB-24346 feat (document schema) - Fixed editing schema validatio…
M4xymm Sep 29, 2025
25c4a40
RavenDB-24346 feat (document schema) - Added disable/enable to docume…
M4xymm Sep 29, 2025
4635985
RavenDB-24346 feat (document schema) - PRETTIER
M4xymm Sep 29, 2025
3c4aabf
RDoc-3515 About text for Document Schema view + tooltips
Danielle9897 Oct 5, 2025
f04d115
RavenDB-24346 feat (document schema) - Added filtering by status and …
M4xymm Oct 6, 2025
efae638
RavenDB-24346 feat (document schema) - Added global toggle for enabli…
M4xymm Oct 6, 2025
69b3d08
RavenDB-24346 feat (document schema) - Improved UI and logic for enab…
M4xymm Oct 6, 2025
7023b3f
RavenDB-24346 feat (document schema) - Added JSON Schema validation u…
M4xymm Oct 8, 2025
361123c
RavenDB-24346 feat (document schema) - Renamed `globalDisabled` to `i…
M4xymm Oct 14, 2025
2321c0d
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Nov 13, 2025
74edd2e
Merge pull request #21775 from ppekrol/feature/json-schema
ppekrol Nov 13, 2025
1d5f55f
Merge branch 'v7.1' of https://github.com/ravendb/ravendb into featur…
ppekrol Nov 26, 2025
527c464
Merge pull request #21865 from ppekrol/feature/json-schema
ppekrol Nov 26, 2025
5bd3024
Merge branch 'v7.2' of https://github.com/ravendb/ravendb into v7.2
grisha-kotler Dec 8, 2025
acec8be
Merge pull request #21923 from grisha-kotler/Schema-Validation-7.2
ppekrol Dec 8, 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
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageVersion Include="NLog" Version="5.5.1" />
<PackageVersion Include="NLog.Web.AspNetCore" Version="5.5.0" />
<PackageVersion Include="NJsonSchema" Version="11.3.2" />
<PackageVersion Include="NodaTime" Version="3.2.2" />
<PackageVersion Include="Npgsql" Version="9.0.4" />
<PackageVersion Include="NuGet.Commands" Version="7.0.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Net.Http;
using Raven.Client.Documents.Conventions;
using Raven.Client.Http;
using Raven.Client.Json;
using Raven.Client.Json.Serialization;
using Raven.Client.Util;
using Sparrow.Json;

namespace Raven.Client.Documents.Operations.SchemaValidation;

public class ConfigureSchemaValidationOperation : IMaintenanceOperation<ConfigureSchemaValidationOperationResult>
{
private readonly SchemaValidationConfiguration _configuration;

/// <inheritdoc cref="ConfigureSchemaValidationOperation"/>
/// <param name="configuration">The schema validation configuration to apply.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="configuration"/> is null.</exception>
public ConfigureSchemaValidationOperation(SchemaValidationConfiguration configuration)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
}

public RavenCommand<ConfigureSchemaValidationOperationResult> GetCommand(DocumentConventions conventions, JsonOperationContext ctx)
{
return new ConfigureSchemaValidationCommand(conventions, _configuration);
}

private class ConfigureSchemaValidationCommand : RavenCommand<ConfigureSchemaValidationOperationResult>, IRaftCommand
{
private readonly DocumentConventions _conventions;
private readonly SchemaValidationConfiguration _configuration;

public ConfigureSchemaValidationCommand(DocumentConventions conventions, SchemaValidationConfiguration configuration)
{
_conventions = conventions ?? throw new ArgumentNullException(nameof(conventions));
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
}

public override bool IsReadRequest => false;

public override HttpRequestMessage CreateRequest(JsonOperationContext ctx, ServerNode node, out string url)
{
url = $"{node.Url}/databases/{node.Database}/admin/schema-validation/config";

var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
Content = new BlittableJsonContent(async stream => await ctx.WriteAsync(stream, DocumentConventions.Default.Serialization.DefaultConverter.ToBlittable(_configuration, ctx)).ConfigureAwait(false), _conventions)
};

return request;
}

public override void SetResponse(JsonOperationContext context, BlittableJsonReaderObject response, bool fromCache)
{
if (response == null)
ThrowInvalidResponse();

Result = JsonDeserializationClient.ConfigureSchemaValidationOperationResult(response);
}

public string RaftUniqueRequestId { get; } = RaftIdGenerator.NewId();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Raven.Client.Documents.Operations.SchemaValidation;

public class ConfigureSchemaValidationOperationResult
{
public long? RaftCommandIndex { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Net.Http;
using Raven.Client.Documents.Conventions;
using Raven.Client.Http;
using Raven.Client.Json.Serialization;
using Sparrow.Json;

namespace Raven.Client.Documents.Operations.SchemaValidation;

public sealed class GetSchemaValidationConfiguration : IMaintenanceOperation<GetSchemaValidationConfigurationResult>
{
public RavenCommand<GetSchemaValidationConfigurationResult> GetCommand(DocumentConventions conventions, JsonOperationContext context)
{
return new GetSchemaValidationCommand();
}

internal sealed class GetSchemaValidationCommand : RavenCommand<GetSchemaValidationConfigurationResult>
{
public override bool IsReadRequest => true;

public override HttpRequestMessage CreateRequest(JsonOperationContext ctx, ServerNode node, out string url)
{
url = $"{node.Url}/databases/{node.Database}/schema-validation/config";

var request = new HttpRequestMessage
{
Method = HttpMethod.Get
};

return request;
}

public override void SetResponse(JsonOperationContext context, BlittableJsonReaderObject response, bool fromCache)
{
if (response == null)
return;

Result = JsonDeserializationClient.GetSchemaValidationConfiguration(response);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Raven.Client.Documents.Operations.SchemaValidation;

public sealed class GetSchemaValidationConfigurationResult
{
public SchemaValidationConfiguration Configuration { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using Sparrow.Json.Parsing;

namespace Raven.Client.Documents.Operations.SchemaValidation;

public class SchemaDefinition
{
public bool Disabled { get; set; }

public string Schema { get; set; }

public DateTime LastModifiedTime { get; } = DateTime.UtcNow;

public DynamicJsonValue ToJson()
{
return new DynamicJsonValue
{
[nameof(Disabled)] = Disabled,
[nameof(Schema)] = Schema,
[nameof(LastModifiedTime)] = LastModifiedTime
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using Sparrow.Json.Parsing;

namespace Raven.Client.Documents.Operations.SchemaValidation;

public sealed class SchemaValidationConfiguration
{
private Dictionary<string, SchemaDefinition> _validatorsPerCollection;

public bool Disabled { get; set; }

public Dictionary<string, SchemaDefinition> ValidatorsPerCollection
{
get => _validatorsPerCollection;
set => _validatorsPerCollection = new Dictionary<string, SchemaDefinition>(value, StringComparer.OrdinalIgnoreCase);
}

public DynamicJsonValue ToJson()
{
DynamicJsonValue validatorsPerCollection = null;
if (ValidatorsPerCollection != null)
{
validatorsPerCollection = new DynamicJsonValue();
foreach (var validator in ValidatorsPerCollection)
{
validatorsPerCollection[validator.Key] = validator.Value.ToJson();
}
}

return new DynamicJsonValue
{
[nameof(Disabled)] = Disabled,
[nameof(ValidatorsPerCollection)] = validatorsPerCollection
};
}
}
1 change: 1 addition & 0 deletions src/Raven.Client/Documents/Smuggler/DatabaseItemType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ public enum DatabaseRecordItemType : long
AiConnectionStrings = 1L << 33,
GenAiEtls = 1L << 34,
AiAgents = 1L << 35,
SchemaValidation = 1L << 36
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public class DatabaseSmugglerOptions : IDatabaseSmugglerOptions
DatabaseRecordItemType.EmbeddingsGenerations |
DatabaseRecordItemType.AiConnectionStrings |
DatabaseRecordItemType.GenAiEtls |
DatabaseRecordItemType.AiAgents;
DatabaseRecordItemType.AiAgents |
DatabaseRecordItemType.SchemaValidation;

internal const DatabaseItemType OperateOnFirstShardOnly = DatabaseItemType.Indexes |
DatabaseItemType.DatabaseRecord |
Expand Down
8 changes: 8 additions & 0 deletions src/Raven.Client/Documents/Smuggler/SmugglerProgressBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public sealed class DatabaseRecordProgress : Counts

public bool ConflictSolverConfigUpdated { get; set; }

public bool SchemaValidationConfigUpdated { get; set; }

public bool TimeSeriesConfigurationUpdated { get; set; }

public bool DocumentsCompressionConfigurationUpdated { get; set; }
Expand Down Expand Up @@ -184,6 +186,9 @@ public override DynamicJsonValue ToJson()
if (ConflictSolverConfigUpdated)
json[nameof(ConflictSolverConfigUpdated)] = ConflictSolverConfigUpdated;

if (SchemaValidationConfigUpdated)
json[nameof(SchemaValidationConfigUpdated)] = SchemaValidationConfigUpdated;

if (PeriodicBackupsUpdated)
json[nameof(PeriodicBackupsUpdated)] = PeriodicBackupsUpdated;

Expand Down Expand Up @@ -286,6 +291,9 @@ public override string ToString()
if (ConflictSolverConfigUpdated)
sb.AppendLine("- Conflicts Solvers");

if (SchemaValidationConfigUpdated)
sb.AppendLine("- Schema Validation Configurations");

if (PeriodicBackupsUpdated)
sb.AppendLine("- Periodic Backups");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Raven.Client.Exceptions.SchemaValidation;

public class SchemaValidationException : RavenException
{
/// <summary>
/// Initializes a new instance of the <see cref="SchemaValidationException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public SchemaValidationException(string message) : base(message)
{
}
}
10 changes: 7 additions & 3 deletions src/Raven.Client/Json/Serialization/JsonDeserializationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using Raven.Client.Documents.Operations.Refresh;
using Raven.Client.Documents.Operations.Replication;
using Raven.Client.Documents.Operations.Revisions;
using Raven.Client.Documents.Operations.SchemaValidation;
using Raven.Client.Documents.Operations.TimeSeries;
using Raven.Client.Documents.Operations.TransactionsRecording;
using Raven.Client.Documents.Queries;
Expand Down Expand Up @@ -198,6 +199,8 @@ internal sealed class JsonDeserializationClient : JsonDeserializationBase
internal static readonly Func<BlittableJsonReaderObject, ConfigureRevisionsBinCleanerOperationResult> ConfigureRevisionsBinCleanerOperationResult = GenerateJsonDeserializationRoutine<ConfigureRevisionsBinCleanerOperationResult>();

internal static readonly Func<BlittableJsonReaderObject, ConfigureDataArchivalOperationResult> ConfigureDataArchivalOperationResult = GenerateJsonDeserializationRoutine<ConfigureDataArchivalOperationResult>();

internal static readonly Func<BlittableJsonReaderObject, ConfigureSchemaValidationOperationResult> ConfigureSchemaValidationOperationResult = GenerateJsonDeserializationRoutine<ConfigureSchemaValidationOperationResult>();

internal static readonly Func<BlittableJsonReaderObject, DocumentCompressionConfigurationResult> DocumentCompressionConfigurationOperationResult = GenerateJsonDeserializationRoutine<DocumentCompressionConfigurationResult>();

Expand Down Expand Up @@ -270,7 +273,7 @@ internal sealed class JsonDeserializationClient : JsonDeserializationBase
internal static readonly Func<BlittableJsonReaderObject, GetClientConfigurationOperation.Result> ClientConfigurationResult = GenerateJsonDeserializationRoutine<GetClientConfigurationOperation.Result>();

internal static readonly Func<BlittableJsonReaderObject, ConflictSolver> ConflictSolverConfiguration = GenerateJsonDeserializationRoutine<ConflictSolver>();

internal static readonly Func<BlittableJsonReaderObject, S3Settings> S3Settings = GenerateJsonDeserializationRoutine<S3Settings>();

internal static readonly Func<BlittableJsonReaderObject, GlacierSettings> GlacierSettings = GenerateJsonDeserializationRoutine<GlacierSettings>();
Expand All @@ -297,7 +300,9 @@ internal sealed class JsonDeserializationClient : JsonDeserializationBase
internal static readonly Func<BlittableJsonReaderObject, GetRevisionsCountOperation.DocumentRevisionsCount> DocumentRevisionsCount = GenerateJsonDeserializationRoutine<GetRevisionsCountOperation.DocumentRevisionsCount>();

internal static readonly Func<BlittableJsonReaderObject, DatabaseSettings> DatabaseSettings = GenerateJsonDeserializationRoutine<DatabaseSettings>();


internal static readonly Func<BlittableJsonReaderObject, GetSchemaValidationConfigurationResult> GetSchemaValidationConfiguration = GenerateJsonDeserializationRoutine<GetSchemaValidationConfigurationResult>();

public static readonly Func<BlittableJsonReaderObject, PutTrafficWatchConfigurationOperation.Parameters> GetTrafficWatchConfigurationResult = GenerateJsonDeserializationRoutine<PutTrafficWatchConfigurationOperation.Parameters>();

internal static readonly Func<BlittableJsonReaderObject, ConfigurePostgreSqlOperationResult> ConfigurePostgreSqlOperationResult = GenerateJsonDeserializationRoutine<ConfigurePostgreSqlOperationResult>();
Expand Down Expand Up @@ -341,7 +346,6 @@ internal sealed class JsonDeserializationClient : JsonDeserializationBase
public static readonly Func<BlittableJsonReaderObject, EmbeddingsGeneration> GetOngoingTaskEmbeddingsGenerationResult = GenerateJsonDeserializationRoutine<EmbeddingsGeneration>();

public static readonly Func<BlittableJsonReaderObject, GenAi> GetOngoingTaskGenAiResult = GenerateJsonDeserializationRoutine<GenAi>();

public static readonly Func<BlittableJsonReaderObject, AiAgentConfiguration> AiAgentConfiguration = GenerateJsonDeserializationRoutine<AiAgentConfiguration>();

public static readonly Func<BlittableJsonReaderObject, GetAiAgentsResponse> GetAiAgentsResponse = GenerateJsonDeserializationRoutine<GetAiAgentsResponse>();
Expand Down
3 changes: 3 additions & 0 deletions src/Raven.Client/ServerWide/DatabaseRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Raven.Client.Documents.Operations.Refresh;
using Raven.Client.Documents.Operations.Replication;
using Raven.Client.Documents.Operations.Revisions;
using Raven.Client.Documents.Operations.SchemaValidation;
using Raven.Client.Documents.Operations.TimeSeries;
using Raven.Client.Documents.Queries.Sorting;
using Raven.Client.Exceptions.Documents.Indexes;
Expand Down Expand Up @@ -76,6 +77,8 @@ public DatabaseRecord(string databaseName)

public ConflictSolver ConflictSolverConfig;

public SchemaValidationConfiguration SchemaValidation;

public DocumentsCompressionConfiguration DocumentsCompression;

public Dictionary<string, SorterDefinition> Sorters = new Dictionary<string, SorterDefinition>();
Expand Down
15 changes: 12 additions & 3 deletions src/Raven.Server/Documents/DocumentDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@
using MountPointUsage = Raven.Client.ServerWide.Operations.MountPointUsage;
using Size = Raven.Client.Util.Size;
using System.Diagnostics.CodeAnalysis;
using Raven.Server.Documents.AI;
using Raven.Server.Documents.AI.Embeddings;
using Raven.Server.Logging;
using Raven.Server.Rachis;
using Raven.Server.Documents.SchemaValidation;
using Sparrow.Server.Logging;
using Sparrow.Server.Utils;

Expand Down Expand Up @@ -311,6 +309,8 @@ internal virtual void SetIds(DatabaseTopology topology, string shardedDatabaseId

public PeriodicBackupRunner PeriodicBackupRunner { get; private set; }

public SchemaValidatorCache SchemaValidatorCache { get; private set; }

public TombstoneCleaner TombstoneCleaner { get; private set; }

public RevisionsBinCleaner RevisionsBinCleaner { get; set; }
Expand Down Expand Up @@ -446,6 +446,7 @@ record = _serverStore.Cluster.ReadDatabase(context, Name, out index);

ReplicationLoader = CreateReplicationLoader();
PeriodicBackupRunner = new PeriodicBackupRunner(this, _serverStore, wakeup);
SchemaValidatorCache = new SchemaValidatorCache(DocumentsStorage.ContextPool, Loggers.GetLogger<SchemaValidatorCache>());

_addToInitLog(LogLevel.Debug, "Initializing IndexStore (async)");
_indexStoreTask = IndexStore.InitializeAsync(record, index, _addToInitLog);
Expand Down Expand Up @@ -1241,6 +1242,13 @@ private void DisposeBackgroundWorkers(ExceptionAggregator exceptionAggregator)
});
ForTestingPurposes?.DisposeLog?.Invoke(Name, "Disposed PeriodicBackupRunner");

ForTestingPurposes?.DisposeLog?.Invoke(Name, "Disposing SchemaValidatorCache");
exceptionAggregator.Execute(() =>
{
SchemaValidatorCache?.Dispose();
});
ForTestingPurposes?.DisposeLog?.Invoke(Name, "Disposed SchemaValidatorCache");

ForTestingPurposes?.DisposeLog?.Invoke(Name, "Disposing TombstoneCleaner");
exceptionAggregator.Execute(() =>
{
Expand Down Expand Up @@ -1739,6 +1747,7 @@ public async Task UpdateOnStateChange(DatabaseRecord record, long index)
try
{
PeriodicBackupRunner?.UpdateConfigurations(record.PeriodicBackups);
SchemaValidatorCache?.Update(record.SchemaValidation);
EmbeddingsGeneratorQueries?.HandleDatabaseRecordChange(record);
EmbeddingsGeneratorEtl?.HandleDatabaseRecordChange(record);
EtlLoader?.HandleDatabaseRecordChange(record);
Expand Down
4 changes: 3 additions & 1 deletion src/Raven.Server/Documents/DocumentPutAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public PutOperationResults PutDocument(DocumentsOperationContext context, string

var collectionName = _documentsStorage.ExtractCollectionName(context, document);
_documentsStorage._forTestingPurposes?.OnBeforeOpenTableWhenPutDocumentWithSpecificId?.Invoke(id);


_documentDatabase.SchemaValidatorCache?.Validate(collectionName.Name, document, nonPersistentFlags, context);

var table = context.Transaction.InnerTransaction.OpenTable(_documentDatabase.GetDocsSchemaForCollection(collectionName, newFlags), collectionName.GetTableName(CollectionTableType.Documents));

var oldValue = default(TableValueReader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public sealed class ServerWideDebugInfoPackageHandler : ServerRequestHandler
nameof(DatabaseRecord.Analyzers),
nameof(DatabaseRecord.TimeSeries),
nameof(DatabaseRecord.SupportedFeatures),
nameof(DatabaseRecord.SchemaValidation),

nameof(DatabaseRecord.Sharding),
nameof(DatabaseRecord.RevisionsBin),
Expand Down
Loading
Loading