-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0faeaf
commit 7e62a8e
Showing
99 changed files
with
6,921 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use common::{capabilities::capabilities_response, config_file::ServerConfigFile}; | ||
use insta::assert_yaml_snapshot; | ||
use schemars::schema_for; | ||
|
||
#[test] | ||
fn test_capabilities() { | ||
assert_yaml_snapshot!("Capabilities", capabilities_response()) | ||
} | ||
|
||
#[test] | ||
fn test_configuration_schema() { | ||
assert_yaml_snapshot!("Server Configuration File", schema_for!(ServerConfigFile)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: crates/common/tests/common.rs | ||
expression: capabilities_response() | ||
--- | ||
version: 0.1.6 | ||
capabilities: | ||
query: | ||
aggregates: {} | ||
variables: {} | ||
explain: {} | ||
nested_fields: {} | ||
exists: {} | ||
mutation: {} | ||
relationships: | ||
relation_comparisons: {} | ||
order_by_aggregate: {} |
137 changes: 137 additions & 0 deletions
137
crates/common/tests/snapshots/common__Server Configuration File.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
--- | ||
source: crates/common/tests/common.rs | ||
expression: schema_for!(ServerConfigFile) | ||
--- | ||
$schema: "http://json-schema.org/draft-07/schema#" | ||
title: ServerConfigFile | ||
description: the main configuration file | ||
type: object | ||
required: | ||
- $schema | ||
properties: | ||
$schema: | ||
type: string | ||
tables: | ||
description: "A list of tables available in this database\n\nThe map key is a unique table alias that defaults to defaults to \"<table_schema>_<table_name>\", except for tables in the \"default\" schema where the table name is used This is the name exposed to the engine, and may be configured by users. When the configuration is updated, the table is identified by name and schema, and changes to the alias are preserved." | ||
type: object | ||
additionalProperties: | ||
$ref: "#/definitions/TableConfigFile" | ||
queries: | ||
description: Optionally define custom parameterized queries here Note the names must not match table names | ||
type: object | ||
additionalProperties: | ||
$ref: "#/definitions/ParameterizedQueryConfigFile" | ||
definitions: | ||
TableConfigFile: | ||
type: object | ||
required: | ||
- name | ||
- return_type | ||
- schema | ||
properties: | ||
name: | ||
description: The table name | ||
type: string | ||
schema: | ||
description: The table schema | ||
type: string | ||
comment: | ||
description: Comments are sourced from the database table comment | ||
type: | ||
- string | ||
- "null" | ||
primary_key: | ||
anyOf: | ||
- $ref: "#/definitions/PrimaryKey" | ||
- type: "null" | ||
arguments: | ||
type: object | ||
additionalProperties: | ||
type: string | ||
return_type: | ||
description: "The map key is a column alias identifying the table and may be customized. It defaults to the table name. When the configuration is updated, the column is identified by name, and changes to the alias are preserved." | ||
allOf: | ||
- $ref: "#/definitions/ReturnType" | ||
PrimaryKey: | ||
type: object | ||
required: | ||
- columns | ||
- name | ||
properties: | ||
name: | ||
type: string | ||
columns: | ||
description: The names of columns in this primary key | ||
type: array | ||
items: | ||
type: string | ||
ReturnType: | ||
oneOf: | ||
- description: "A custom return type definition The keys are column names, the values are parsable clichouse datatypes" | ||
type: object | ||
required: | ||
- columns | ||
- kind | ||
properties: | ||
kind: | ||
type: string | ||
enum: | ||
- definition | ||
columns: | ||
type: object | ||
additionalProperties: | ||
type: string | ||
- description: the same as the return type for another table | ||
type: object | ||
required: | ||
- kind | ||
- table_name | ||
properties: | ||
kind: | ||
type: string | ||
enum: | ||
- table_reference | ||
table_name: | ||
description: "the table alias must match a key in `tables`, and the query must return the same type as that table alternatively, the alias may reference another parameterized query which has a return type definition," | ||
type: string | ||
- description: The same as the return type for another query | ||
type: object | ||
required: | ||
- kind | ||
- query_name | ||
properties: | ||
kind: | ||
type: string | ||
enum: | ||
- query_reference | ||
query_name: | ||
description: "the table alias must match a key in `tables`, and the query must return the same type as that table alternatively, the alias may reference another parameterized query which has a return type definition," | ||
type: string | ||
ParameterizedQueryConfigFile: | ||
type: object | ||
required: | ||
- exposed_as | ||
- file | ||
- return_type | ||
properties: | ||
exposed_as: | ||
description: Whether this query should be exposed as a procedure (mutating) or collection (non-mutating) | ||
allOf: | ||
- $ref: "#/definitions/ParameterizedQueryExposedAs" | ||
comment: | ||
description: A comment that will be exposed in the schema | ||
type: | ||
- string | ||
- "null" | ||
file: | ||
description: A relative path to a sql file | ||
type: string | ||
return_type: | ||
description: "Either a type definition for the return type for this query, or a reference to another return type: either a table's alias, or another query's alias. If another query, that query must have a return type definition." | ||
allOf: | ||
- $ref: "#/definitions/ReturnType" | ||
ParameterizedQueryExposedAs: | ||
type: string | ||
enum: | ||
- collection | ||
- procedure |
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
crates/ndc-clickhouse/tests/capabilities/capabilities.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.