MCPcopy Create free account
hub / github.com/documentdb/documentdb / ProcessJsonschemaInIter

Function ProcessJsonschemaInIter

pg_documentdb/src/metadata/collection.c:1928–1964  ·  view source on GitHub ↗

* This function processes the $jsonSchema in the bson iter. * It checks if the $jsonSchema is present and calls CheckSyntaxForValidator * to validate the syntax of the validator. */

Source from the content-addressed store, hash-verified

1926 * to validate the syntax of the validator.
1927 */
1928static void
1929ProcessJsonschemaInIter(bson_iter_t *iter)
1930{
1931 CHECK_FOR_INTERRUPTS();
1932 check_stack_depth();
1933
1934 bson_iter_t childIter, arrayIter;
1935
1936 if (bson_iter_recurse(iter, &childIter))
1937 {
1938 while (bson_iter_next(&childIter))
1939 {
1940 if (strcmp(bson_iter_key(&childIter), "$jsonSchema") == 0)
1941 {
1942 CheckSyntaxForValidator(&childIter);
1943 return;
1944 }
1945 else if (BSON_ITER_HOLDS_ARRAY(&childIter) && bson_iter_recurse(&childIter,
1946 &arrayIter))
1947 {
1948 while (bson_iter_next(&arrayIter))
1949 {
1950 if (BSON_ITER_HOLDS_DOCUMENT(&arrayIter))
1951 {
1952 bson_iter_t subIter;
1953 if (bson_iter_recurse(&arrayIter, &subIter) &&
1954 bson_iter_find(&subIter, "$jsonSchema"))
1955 {
1956 CheckSyntaxForValidator(&subIter);
1957 return;
1958 }
1959 }
1960 }
1961 }
1962 }
1963 }
1964}
1965
1966
1967/*

Callers 1

ParseAndGetValidatorSpecFunction · 0.85

Calls 1

CheckSyntaxForValidatorFunction · 0.85

Tested by

no test coverage detected