Skip to content

Releases: hasura/ndc-spec

v0.2.1

23 Apr 19:24
c50e190
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.2.1

v0.2.0

16 Mar 16:10
v0.2.0
e25213f
Compare
Choose a tag to compare

Breaking Changes

  • ComparisonTarget::RootCollectionColumn was removed and replaced by named scopes (RFC)
  • path was removed from ComparisonTarget::Column (RFC)
  • AggregateFunctionDefinition was changed to an enum, to support standardized aggregate functions (RFC)
  • ComparisonValue::Column no longer uses ComparisonTarget to pick the column. Instead, the necessary column and pathing details are inlined onto the enum variant.
  • Declarations of foreign keys has moved from CollectionInfo to ObjectType. This enables object types nested within a collection's object type to declare foreign keys.
  • The target column in column mappings can now reference an object-nested field. The target column is now a field path (Vec<FieldName>) instead of just a field (FieldName). Column mappings occur in:
    • Relationship::column_mapping
    • ForeignKeyConstraint::column_mapping
  • Scalar type representations are now required, and the previously deprecated number and integer representations have been removed.
  • If the capability query.aggregates is enabled, it is now expected that the new schema property capabilities.query.aggregates is also returned.

Specification

Grouping

A new section was added to the specification which allows callers to group rows and aggregate within groups, generalizing SQL's GROUP BY functionality.

Extraction Functions

Extraction functions were added to the schema response to facilitate grouping by components of complex dimensions.

Named scopes

Root column references were generalized to named scopes. Scopes are introduced by EXISTS expressions, and named scopes allow references to columns outside of the current scope; that is, outside the EXISTS expression. Unlike root column references, named scopes allow the caller to refer to columns in any collection in scope, and not just the root collection.

Nested collections

Filtering involving nested scalar arrays

Nested scalar arrays can now be compared against in filter expressions.

Filter by aggregates

ComparisonTarget was extended to allow filtering by aggregates.

Nested relationships

Nested relationships are relationships where the columns being joined upon exist on nested objects within collection's object type. While NDC 0.1.x supports selecting fields across a relationship that starts from within a nested object, it does not support nested relationships in other contexts, such as filtering and ordering. To resolve this, the following additions have been made:

  • ExistsInCollection::Related has gained a field_path field that enables descent through nested fields before applying the relationship. This enables support for filtering across a nested relationship.
  • PathElement has also gained a field_path field that enables descent through nested fields before applying the relationship. PathElement is used in multiple places, which unlocks nested relationships in these places:
    • ComparisonValue::Column - part of filter predicates; where the right hand side of a comparison operation references a column
    • ComparisonTarget::Aggregate - part of filter predicates; where the left hand side of a comparison operation references an aggregate
    • OrderByTarget::Column - when you want to order by a column across an object relationship
    • OrderByTarget::Aggregate - when you want to order by an aggregate that happens across a nested object relationship
    • Dimension::Column - when selecting a column to group by that occurs across a nested object relationship

Column mappings used in relationships were also modified to allow the target column to be referenced via a field path, to allow targeting of object-nested columns across a relationship. Foreign keys are also now defined on the object type rather than the collection, which allows the declaration of foreign keys on object types that are used in nested fields inside a collection.

Nested relationships are now gated behind the relationships.nested capabilities, and so connectors that do not declare these capabilities can expect to not have to deal with nested relationships.

Wider field arguments support

Object type fields can declare arguments that must be submitted when the field is evaluated. However, support for using these fields is not universal; there are some features which do not allow the use of fields with arguments, for example in nested field paths, or in relationship column mappings.

Now, support for field arguments has been added to:

  • ComparisonTarget::Column
  • ComparisonValue::Column
  • OrderByTarget::Column
  • Aggregate::ColumnCount
  • Aggregate::SingleColumn

However, field arguments are still considered an unstable feature and their use is not recommended outside of very specialized, advanced use cases.

More standard comparison operators, standard aggregate functions

Standard comparison operators have been added for >, >=, <, and <=, and string comparisons contains, icontains, starts_with, istarts_with, ends_with and ends_with. Connectors that have already defined these operators as custom operators should migrate them to standard operators.

In addition, aggregate functions now have a set of standard functions that can be implemented: sum, average, min, max. Connectors that have already defined these functions as custom aggregate functions should migrate them to standard aggregate functions.

X-Hasura-NDC-Version header

Clients can now indicate the intended protocol version in a HTTP header alongside any request.

Scalar type representations

Scalar type representations are now required; previously they were optional, where a missing representation was assumed to mean JSON. In addition, the deprecated number and integer representations have been removed; a more precise representation (such as float64 or int32) should be chosen instead.

Capability-specific schema information

Certain capabilities may require specific data to be returned in the schema to support them. This data is now returned in the capabilities property on the schema response.

Specifically, there is a new schema property, capabilities.query.aggregates.count_scalar_type, that defines the result type of all count aggregate functions. This must be returned if the capability query.aggregates is enabled.

v0.1.6

20 Aug 09:45
d1be19e
Compare
Choose a tag to compare

Specification

  • EXISTS expressions can now query nested collections

Full Changelog: v0.1.5...v0.1.6

v0.1.5

09 Jul 01:25
78f5276
Compare
Choose a tag to compare

What's Changed

Rust Libraries

  • Add newtypes for string types
  • Expose the specification version in ndc-models

v0.1.4

12 Jun 02:33
20172e3
Compare
Choose a tag to compare

What's Changed

Specification

  • Aggregates over nested fields (#144)

ndc-test

  • replay test folders in alphabetical order (#149)

Fixes

  • Add impl Default for NestedFieldCapabilities (#143)

Full Changelog: v0.1.3...v0.1.4

v0.1.3

28 May 17:06
b9316d2
Compare
Choose a tag to compare

Specification

ndc-test

Rust Libraries

  • Upgrade Rust to v1.78.0, and the Rust dependencies to their latest versions @SamirTalwar (#140)
  • Add back features for native-tls vs rustls @paf31 (#135)

New Contributors

Full Changelog: v0.1.2...v0.1.3

v0.1.2

15 Apr 09:05
6e7d12a
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.1.1...v0.1.2