Skip to content

Commit

Permalink
Bump ndc-spec to v0.1.4. (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Jun 17, 2024
1 parent 81cfa51 commit 21d63c8
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 281 deletions.
531 changes: 267 additions & 264 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ similar_names = "allow"
too_many_lines = "allow"

[workspace.dependencies]
ndc-models = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.3" }
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", rev = "266f4db31777d2a0885a665e0d982237503b223c" }
ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.3" }
ndc-models = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.4" }
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", tag = "v0.1.4" }
ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.4" }

anyhow = "1"
async-trait = "0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ expression: schema
},
"$schema": {
"description": "Jsonschema of the configuration format.",
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -323,6 +324,7 @@ expression: schema
},
"mutationsVersion": {
"description": "Which version of the generated mutation procedures to include in the schema response",
"default": null,
"anyOf": [
{
"$ref": "#/definitions/MutationsVersion"
Expand Down Expand Up @@ -581,6 +583,7 @@ expression: schema
]
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -620,6 +623,7 @@ expression: schema
"$ref": "#/definitions/IsGenerated"
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -777,6 +781,7 @@ expression: schema
}
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand All @@ -799,6 +804,7 @@ expression: schema
"$ref": "#/definitions/Type"
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -845,6 +851,7 @@ expression: schema
}
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -920,6 +927,7 @@ expression: schema
]
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ expression: schema
},
"$schema": {
"description": "Jsonschema of the configuration format.",
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -334,6 +335,7 @@ expression: schema
},
"mutationsVersion": {
"description": "Which version of the generated mutation procedures to include in the schema response",
"default": null,
"anyOf": [
{
"$ref": "#/definitions/MutationsVersion"
Expand Down Expand Up @@ -576,6 +578,7 @@ expression: schema
]
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -615,6 +618,7 @@ expression: schema
"$ref": "#/definitions/IsGenerated"
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -1045,6 +1049,7 @@ expression: schema
}
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand All @@ -1067,6 +1072,7 @@ expression: schema
"$ref": "#/definitions/Type"
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -1113,6 +1119,7 @@ expression: schema
}
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down Expand Up @@ -1188,6 +1195,7 @@ expression: schema
]
},
"description": {
"default": null,
"type": [
"string",
"null"
Expand Down
3 changes: 2 additions & 1 deletion crates/connectors/ndc-postgres/src/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ndc_sdk::models;
/// from the NDC specification.
pub fn get_capabilities() -> models::CapabilitiesResponse {
models::CapabilitiesResponse {
version: "0.1.3".into(),
version: "0.1.4".into(),
capabilities: models::Capabilities {
query: models::QueryCapabilities {
aggregates: Some(models::LeafCapability {}),
Expand All @@ -17,6 +17,7 @@ pub fn get_capabilities() -> models::CapabilitiesResponse {
nested_fields: models::NestedFieldCapabilities {
filter_by: Some(models::LeafCapability {}),
order_by: Some(models::LeafCapability {}),
aggregates: None,
},
},
mutation: models::MutationCapabilities {
Expand Down
30 changes: 18 additions & 12 deletions crates/query-engine/translation/src/translation/query/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ pub fn translate(
.into_iter()
.map(|(alias, aggregation)| {
let expression = match aggregation {
models::Aggregate::ColumnCount { column, distinct } => {
models::Aggregate::ColumnCount {
column,
distinct,
field_path: _,
} => {
let count_column_alias = sql::helpers::make_column_alias(column.clone());
if *distinct {
sql::ast::Expression::Count(sql::ast::CountType::Distinct(
Expand All @@ -34,17 +38,19 @@ pub fn translate(
))
}
}
models::Aggregate::SingleColumn { column, function } => {
sql::ast::Expression::FunctionCall {
function: sql::ast::Function::Unknown(function.clone()),
args: vec![sql::ast::Expression::ColumnReference(
sql::ast::ColumnReference::AliasedColumn {
table: table.clone(),
column: sql::helpers::make_column_alias(column.clone()),
},
)],
}
}
models::Aggregate::SingleColumn {
column,
function,
field_path: _,
} => sql::ast::Expression::FunctionCall {
function: sql::ast::Function::Unknown(function.clone()),
args: vec![sql::ast::Expression::ColumnReference(
sql::ast::ColumnReference::AliasedColumn {
table: table.clone(),
column: sql::helpers::make_column_alias(column.clone()),
},
)],
},
models::Aggregate::StarCount {} => {
sql::ast::Expression::Count(sql::ast::CountType::Star)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec<OrderByElementGrou
path,
column,
function,
field_path: _,
} => aggregate_element_groups.insert(
hash_path(path),
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: crates/tests/databases-tests/src/capabilities_tests.rs
expression: "ndc_postgres::capabilities::get_capabilities()"
---
{
"version": "0.1.3",
"version": "0.1.4",
"capabilities": {
"query": {
"aggregates": {},
Expand Down

0 comments on commit 21d63c8

Please sign in to comment.