Skip to content

Commit

Permalink
Support for ndc-spec v0.1.4 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers authored Jun 19, 2024
1 parent 6aab9a8 commit 8310045
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.1.0
- Updated to support [v0.1.4 of the NDC Spec](https://hasura.github.io/ndc-spec/specification/changelog.html#014) ([#33](https://github.com/hasura/ndc-sdk-typescript/pull/33))
- Support for [aggregates](https://hasura.github.io/ndc-spec/specification/queries/aggregates.html) over nested fields

## 5.0.0
- Updated to support [v0.1.3 of the NDC Spec](https://hasura.github.io/ndc-spec/specification/changelog.html#013) ([#32](https://github.com/hasura/ndc-sdk-typescript/pull/32))
- Breaking change: new `nested_fields` property on `QueryCapabilities`; set it to `{}` to retain previous v0.1.2 semantics and not support new v0.1.3 capabilities.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hasura/ndc-sdk-typescript",
"version": "5.0.0",
"version": "5.1.0",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
45 changes: 42 additions & 3 deletions src/schema/schema.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@
"QueryCapabilities": {
"title": "Query Capabilities",
"type": "object",
"required": [
"nested_fields"
],
"properties": {
"aggregates": {
"description": "Does the connector support aggregate queries",
Expand Down Expand Up @@ -128,6 +125,7 @@
},
"nested_fields": {
"description": "Does the connector support nested fields",
"default": {},
"allOf": [
{
"$ref": "#/definitions/NestedFieldCapabilities"
Expand Down Expand Up @@ -165,6 +163,17 @@
"type": "null"
}
]
},
"aggregates": {
"description": "Does the connector support aggregating values within nested fields",
"anyOf": [
{
"$ref": "#/definitions/LeafCapability"
},
{
"type": "null"
}
]
}
}
},
Expand Down Expand Up @@ -1182,6 +1191,16 @@
"description": "The column to apply the count aggregate function to",
"type": "string"
},
"field_path": {
"description": "Path to a nested field within an object column",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"distinct": {
"description": "Whether or not only distinct items should be counted",
"type": "boolean"
Expand All @@ -1206,6 +1225,16 @@
"description": "The column to apply the aggregation function to",
"type": "string"
},
"field_path": {
"description": "Path to a nested field within an object column",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"function": {
"description": "Single column aggregate function name.",
"type": "string"
Expand Down Expand Up @@ -1544,6 +1573,16 @@
"description": "The column to apply the aggregation function to",
"type": "string"
},
"field_path": {
"description": "Path to a nested field within an object column",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"function": {
"description": "Single column aggregate function name.",
"type": "string"
Expand Down
18 changes: 17 additions & 1 deletion src/schema/schema.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export type Aggregate =
* The column to apply the count aggregate function to
*/
column: string;
/**
* Path to a nested field within an object column
*/
field_path?: string[] | null;
/**
* Whether or not only distinct items should be counted
*/
Expand All @@ -142,6 +146,10 @@ export type Aggregate =
* The column to apply the aggregation function to
*/
column: string;
/**
* Path to a nested field within an object column
*/
field_path?: string[] | null;
/**
* Single column aggregate function name.
*/
Expand Down Expand Up @@ -222,6 +230,10 @@ export type OrderByTarget =
* The column to apply the aggregation function to
*/
column: string;
/**
* Path to a nested field within an object column
*/
field_path?: string[] | null;
/**
* Single column aggregate function name.
*/
Expand Down Expand Up @@ -398,7 +410,7 @@ export interface QueryCapabilities {
/**
* Does the connector support nested fields
*/
nested_fields: NestedFieldCapabilities;
nested_fields?: NestedFieldCapabilities;
}
/**
* A unit value to indicate a particular leaf capability is supported. This is an empty struct to allow for future sub-capabilities.
Expand All @@ -413,6 +425,10 @@ export interface NestedFieldCapabilities {
* Does the connector support ordering by values of nested fields
*/
order_by?: LeafCapability | null;
/**
* Does the connector support aggregating values within nested fields
*/
aggregates?: LeafCapability | null;
}
export interface MutationCapabilities {
/**
Expand Down
2 changes: 1 addition & 1 deletion typegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.3" }
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.4" }
schemars = "0.8.15"
serde = "^1.0"
serde_json = "1.0.107"
Expand Down

0 comments on commit 8310045

Please sign in to comment.