From dd97eab48c31b16e27ba3f314e070a8aa19bfbfe Mon Sep 17 00:00:00 2001 From: CJ Brewer Date: Thu, 24 Oct 2024 13:00:18 -0600 Subject: [PATCH] chore: organize schemas --- cs_encrypted_v1.schema.json | 158 ------------------ sql/cs_configuration_data_v1.schema.json | 133 --------------- sql/cs_encrypted_v1.schema.json | 113 ------------- .../cs_configuration_data_v1.schema.json | 116 +++++++++++++ sql/schemas/cs_encrypted_v1.schema.json | 93 +++++++++++ sql/{ => schemas}/payload-examples.md | 0 6 files changed, 209 insertions(+), 404 deletions(-) delete mode 100644 cs_encrypted_v1.schema.json delete mode 100644 sql/cs_configuration_data_v1.schema.json delete mode 100644 sql/cs_encrypted_v1.schema.json create mode 100644 sql/schemas/cs_configuration_data_v1.schema.json create mode 100644 sql/schemas/cs_encrypted_v1.schema.json rename sql/{ => schemas}/payload-examples.md (100%) diff --git a/cs_encrypted_v1.schema.json b/cs_encrypted_v1.schema.json deleted file mode 100644 index 3ce2d8b..0000000 --- a/cs_encrypted_v1.schema.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "s": { - "title": "Schema version", - "description": "The schema version of this json document", - "type": "integer", - "enum": [1] - }, - "v": { - "title": "Configuration version", - "type": "integer" - }, - "k": { - "title": "kind", - "type": "string", - "enum": ["pt", "ct", "en", "qm", "qo", "qu", "qejp", "qsv"] - }, - "i": { - "title": "ident", - "type": "object", - "properties": { - "t": { - "title": "table", - "type": "string", - "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" - }, - "c": { - "title": "column", - "type": "string", - "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" - } - }, - "required": ["t", "c"] - }, - "p": { - "title": "plaintext", - "type": "string" - }, - "c": { - "title": "ciphertext", - "type": "string" - }, - "u": { - "title": "unique index", - "type": "string" - }, - "o": { - "title": "ore index", - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }, - "m": { - "title": "match index", - "type": "array", - "minItems": 1, - "items": { - "type": "number" - } - }, - "sv": { - "title": "STE vec index", - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }, - "se": { - "title": "EJSON path selector", - "type": "string" - } - }, - "anyOf": [ - { - "properties": { - "k": { - "const": "pt" - }, - "q": { - "title": "for query", - "description": "Specifies that the plaintext should be encrypted for a specific query operation. If null, source encryption and encryption for all indexes will be performed.", - "type": "string", - "enum": [ - "match", - "ore", - "unique", - "ste_vec", - "ejson_path", - "websearch_to_match" - ] - } - }, - "required": ["p", "i"] - }, - { - "properties": { - "k": { - "const": "ct" - } - }, - "required": ["c", "i"] - }, - { - "properties": { - "k": { - "const": "en" - } - }, - "required": ["c", "p", "i"] - }, - { - "properties": { - "k": { - "const": "qm" - } - }, - "required": ["m"] - }, - { - "properties": { - "k": { - "const": "qo" - } - }, - "required": ["o"] - }, - { - "properties": { - "k": { - "const": "qu" - } - }, - "required": ["u"] - }, - { - "properties": { - "k": { - "const": "qsv" - } - }, - "required": ["sv"] - }, - { - "properties": { - "k": { - "const": "qejp" - } - }, - "required": ["se"] - } - ], - "required": ["v", "k"] -} diff --git a/sql/cs_configuration_data_v1.schema.json b/sql/cs_configuration_data_v1.schema.json deleted file mode 100644 index 2520a2c..0000000 --- a/sql/cs_configuration_data_v1.schema.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "s": { - "title": "Schema version", - "description": "The schema version of this json document ", - "type": "integer", - "enum": [ - 1 - ] - }, - "tables": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/table" - } - } - }, - "required": [ - "s", - "tables" - ], - "$defs": { - "table": { - "title": "Table configuration", - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/column" - } - }, - "column": { - "title": "Column configuration", - "type": "object", - "properties": { - "cast_as": { - "title": "cast as type", - "description": "The type the decrypted column value will be cast as", - "type": "string", - "enum": [ - "text", - "int" - ] - }, - "indexes": { - "title": "Table configuration", - "type": "object", - "properties": { - "match_1": { - "$ref": "#/$defs/match_1" - }, - "ore_1": { - "$ref": "#/$defs/ore_1" - }, - "unique_1": { - "$ref": "#/$defs/unique_1" - } - }, - "additionalProperties": false - } - } - }, - "token_filters": { - "title": "Token filters", - "token_filters": { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "downcase", - "upcase" - ] - } - } - } - }, - "ore_1": { - "title": "Index configuration", - "type": "object", - "additionalProperties": false - }, - "unique_1": { - "title": "Unique index v1", - "type": "object", - "properties": { - "token_filters": { - "$ref": "#/$defs/token_filters" - } - } - }, - "match_1": { - "title": "Index configuration", - "type": "object", - "properties": { - "k": { - "type": "integer" - }, - "m": { - "type": "integer" - }, - "tokenizer": { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "edge-ngram", - "ngram" - ] - }, - "min_gram": { - "type": "integer" - }, - "max_gram": { - "type": "integer" - }, - "include_original": { - "type": "boolean" - } - } - }, - "token_filters": { - "$ref": "#/$defs/token_filters" - } - }, - "required": [ - "k", - "m" - ] - } - } -} \ No newline at end of file diff --git a/sql/cs_encrypted_v1.schema.json b/sql/cs_encrypted_v1.schema.json deleted file mode 100644 index 1cb1249..0000000 --- a/sql/cs_encrypted_v1.schema.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "s": { - "title": "Schema version", - "description": "The schema version of this json document ", - "type": "integer", - "enum": [ - 1 - ] - }, - "v": { - "title": "Configuration version", - "type": "integer" - }, - "k": { - "title": "kind", - "type": "string", - "enum": [ - "pt", - "ct", - "en" - ] - }, - "i": { - "title": "ident", - "type": "object", - "properties": { - "t": { - "title": "table", - "type": "string", - "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" - }, - "c": { - "title": "column", - "type": "string", - "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" - } - }, - "required": [ - "t", - "c" - ] - }, - "p": { - "title": "plaintext", - "type": "string" - }, - "c": { - "title": "ciphertext", - "type": "string" - }, - "u": { - "title": "unique index", - "type": "string" - }, - "o": { - "title": "ore index", - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }, - "m": { - "title": "match index", - "type": "array", - "minItems": 1, - "items": { - "type": "number" - } - } - }, - "anyOf": [ - { - "properties": { - "k": { - "const": "pt" - } - }, - "required": [ - "p" - ] - }, - { - "properties": { - "k": { - "const": "ct" - } - }, - "required": [ - "c" - ] - }, - { - "properties": { - "k": { - "const": "en" - } - }, - "required": [ - "c", - "p" - ] - } - ], - "required": [ - "v", - "k", - "e" - ] -} \ No newline at end of file diff --git a/sql/schemas/cs_configuration_data_v1.schema.json b/sql/schemas/cs_configuration_data_v1.schema.json new file mode 100644 index 0000000..42c86f4 --- /dev/null +++ b/sql/schemas/cs_configuration_data_v1.schema.json @@ -0,0 +1,116 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "s": { + "title": "Schema version", + "description": "The schema version of this json document ", + "type": "integer", + "enum": [1] + }, + "tables": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/table" + } + } + }, + "required": ["s", "tables"], + "$defs": { + "table": { + "title": "Table configuration", + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/column" + } + }, + "column": { + "title": "Column configuration", + "type": "object", + "properties": { + "cast_as": { + "title": "cast as type", + "description": "The type the decrypted column value will be cast as", + "type": "string", + "enum": ["text", "int"] + }, + "indexes": { + "title": "Table configuration", + "type": "object", + "properties": { + "match_1": { + "$ref": "#/$defs/match_1" + }, + "ore_1": { + "$ref": "#/$defs/ore_1" + }, + "unique_1": { + "$ref": "#/$defs/unique_1" + } + }, + "additionalProperties": false + } + } + }, + "token_filters": { + "title": "Token filters", + "token_filters": { + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": ["downcase", "upcase"] + } + } + } + }, + "ore_1": { + "title": "Index configuration", + "type": "object", + "additionalProperties": false + }, + "unique_1": { + "title": "Unique index v1", + "type": "object", + "properties": { + "token_filters": { + "$ref": "#/$defs/token_filters" + } + } + }, + "match_1": { + "title": "Index configuration", + "type": "object", + "properties": { + "k": { + "type": "integer" + }, + "m": { + "type": "integer" + }, + "tokenizer": { + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": ["edge-ngram", "ngram"] + }, + "min_gram": { + "type": "integer" + }, + "max_gram": { + "type": "integer" + }, + "include_original": { + "type": "boolean" + } + } + }, + "token_filters": { + "$ref": "#/$defs/token_filters" + } + }, + "required": ["k", "m"] + } + } +} diff --git a/sql/schemas/cs_encrypted_v1.schema.json b/sql/schemas/cs_encrypted_v1.schema.json new file mode 100644 index 0000000..c6fff72 --- /dev/null +++ b/sql/schemas/cs_encrypted_v1.schema.json @@ -0,0 +1,93 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "s": { + "title": "Schema version", + "description": "The schema version of this json document ", + "type": "integer", + "enum": [1] + }, + "v": { + "title": "Configuration version", + "type": "integer" + }, + "k": { + "title": "kind", + "type": "string", + "enum": ["pt", "ct", "en"] + }, + "i": { + "title": "ident", + "type": "object", + "properties": { + "t": { + "title": "table", + "type": "string", + "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" + }, + "c": { + "title": "column", + "type": "string", + "pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$" + } + }, + "required": ["t", "c"] + }, + "p": { + "title": "plaintext", + "type": "string" + }, + "c": { + "title": "ciphertext", + "type": "string" + }, + "u": { + "title": "unique index", + "type": "string" + }, + "o": { + "title": "ore index", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "m": { + "title": "match index", + "type": "array", + "minItems": 1, + "items": { + "type": "number" + } + } + }, + "anyOf": [ + { + "properties": { + "k": { + "const": "pt" + } + }, + "required": ["p"] + }, + { + "properties": { + "k": { + "const": "ct" + } + }, + "required": ["c"] + }, + { + "properties": { + "k": { + "const": "en" + } + }, + "required": ["c", "p"] + } + ], + "required": ["v", "k", "e"] +} diff --git a/sql/payload-examples.md b/sql/schemas/payload-examples.md similarity index 100% rename from sql/payload-examples.md rename to sql/schemas/payload-examples.md