Files
documentdb/pg_helio_api/include/schema_validation/schema_validation.h
T
Jia Hu 👻 b36e62a18b Merged PR 1429339: [schema validation] support schema validation in insertion
### 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.
2024-09-05 18:18:23 +03:00

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