mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description [schema validation] support validation in insertion Details about evaluation part is here:https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/pgmongo/pullRequest/1429339#1724674832 ---- #### AI description (iteration 1) #### PR Classification New feature: Adds support for schema validation during document insertion. #### PR Summary This pull request introduces schema validation for document insertions, ensuring that documents adhere to specified schemas before being inserted into collections. - `schema_validation.c`: Implements functions for preparing and validating documents against schema validators. - `insert.c`: Integrates schema validation into the document insertion process. - `bson_expr_eval.c`: Adds functions to evaluate expressions against documents for validation purposes. - `schema_validation_insert.sql` and `schema_validation_insert.out`: Adds regression tests for schema validation during insertions. - `SchemaValidationMetadataTests.cs`: Adds integration tests for schema validation during document insertion.
24 lines
667 B
C
24 lines
667 B
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* src/schema_validation.h
|
|
*
|
|
* Common declarations for schema validation functions.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef SCHEMA_VALIDATION_H
|
|
#define SCHEMA_VALIDATION_H
|
|
|
|
#include "metadata/collection.h"
|
|
#include "operators/bson_expr_eval.h"
|
|
|
|
ExprEvalState * PrepareForSchemaValidation(pgbson *schemaValidationInfo, MemoryContext
|
|
memoryContext);
|
|
|
|
void ValidateSchemaOnDocumentInsert(ExprEvalState *evalState, const
|
|
bson_value_t *document);
|
|
|
|
#endif
|