Skip to content

Commit

Permalink
switch sample_mflix fixture config to use new boolean expression meta…
Browse files Browse the repository at this point in the history
…data (#93)

These changes only affect integration tests and the preconfigured dev environment. The fixture metadata configures two MongoDB connectors: one using MongoDB's sample_mlfix sample data set, the other using a Chinook data set.

Updates object types and scalar types in metadata configuration for both connectors to use `BooleanExpressionType` instead of `ObjectBooleanExpressionType`.

I also moved the scalar type metadata so that it is shared between the sample_mflix and chinook connectors. Now we are using the same set of scalar types with both connectors instead of having `Chinook_` -prefixed types for the chinook connector.

References [NDC-381](https://linear.app/hasura/issue/NDC-381/update-metadata-fixtures-to-configure-aggregations)
  • Loading branch information
hallettj authored Aug 8, 2024
1 parent 4663941 commit 888162e
Show file tree
Hide file tree
Showing 30 changed files with 1,189 additions and 716 deletions.
3 changes: 1 addition & 2 deletions arion-compose/services/engine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ let
connectors));

auth-config = pkgs.writeText "auth_config.json" (builtins.toJSON {
version = "v1";
version = "v2";
definition = {
allowRoleEmulationBy = "admin";
mode.webhook = {
url = auth-webhook.url;
method = "Post";
Expand Down
69 changes: 45 additions & 24 deletions fixtures/hasura/chinook/metadata/ArtistsWithAlbumsAndTracks.hml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ definition:
name: AlbumWithTracks
fields:
- name: id
type: Chinook_ObjectId!
type: ObjectId!
- name: title
type: String!
- name: tracks
type: "[Track!]!"
graphql:
typeName: Chinook_AlbumWithTracks
inputTypeName: Chinook_AlbumWithTracksInput
typeName: AlbumWithTracks
inputTypeName: AlbumWithTracksInput
dataConnectorTypeMapping:
- dataConnectorName: chinook
dataConnectorObjectType: AlbumWithTracks
Expand Down Expand Up @@ -40,21 +40,42 @@ definition:
- title
- tracks

---
kind: BooleanExpressionType
version: v1
definition:
name: AlbumWithTracksComparisonExp
operand:
object:
type: AlbumWithTracks
comparableFields:
- fieldName: id
booleanExpressionType: ObjectIdComparisonExp
- fieldName: title
booleanExpressionType: StringComparisonExp
comparableRelationships: []
logicalOperators:
enable: true
isNull:
enable: true
graphql:
typeName: AlbumWithTracksComparisonExp

---
kind: ObjectType
version: v1
definition:
name: ArtistWithAlbumsAndTracks
fields:
- name: id
type: Chinook_ObjectId!
type: ObjectId!
- name: albums
type: "[AlbumWithTracks!]!"
- name: name
type: String!
graphql:
typeName: Chinook_ArtistWithAlbumsAndTracks
inputTypeName: Chinook_ArtistWithAlbumsAndTracksInput
typeName: ArtistWithAlbumsAndTracks
inputTypeName: ArtistWithAlbumsAndTracksInput
dataConnectorTypeMapping:
- dataConnectorName: chinook
dataConnectorObjectType: ArtistWithAlbumsAndTracks
Expand Down Expand Up @@ -83,25 +104,25 @@ definition:
- name

---
kind: ObjectBooleanExpressionType
kind: BooleanExpressionType
version: v1
definition:
name: ArtistWithAlbumsAndTracksBoolExp
objectType: ArtistWithAlbumsAndTracks
dataConnectorName: chinook
dataConnectorObjectType: ArtistWithAlbumsAndTracks
comparableFields:
- fieldName: id
operators:
enableAll: true
- fieldName: albums
operators:
enableAll: true
- fieldName: name
operators:
enableAll: true
name: ArtistWithAlbumsAndTracksComparisonExp
operand:
object:
type: ArtistWithAlbumsAndTracks
comparableFields:
- fieldName: id
booleanExpressionType: ObjectIdComparisonExp
- fieldName: name
booleanExpressionType: StringComparisonExp
comparableRelationships: []
logicalOperators:
enable: true
isNull:
enable: true
graphql:
typeName: Chinook_ArtistWithAlbumsAndTracksBoolExp
typeName: ArtistWithAlbumsAndTracksComparisonExp

---
kind: Model
Expand All @@ -112,7 +133,7 @@ definition:
source:
dataConnectorName: chinook
collection: artists_with_albums_and_tracks
filterExpressionType: ArtistWithAlbumsAndTracksBoolExp
filterExpressionType: ArtistWithAlbumsAndTracksComparisonExp
orderableFields:
- fieldName: id
orderByDirections:
Expand All @@ -130,7 +151,7 @@ definition:
- queryRootField: artistsWithAlbumsAndTracksById
uniqueIdentifier:
- id
orderByExpressionType: Chinook_ArtistsWithAlbumsAndTracksOrderBy
orderByExpressionType: ArtistsWithAlbumsAndTracksOrderBy
description: combines artist, albums, and tracks into a single document per artist

---
Expand Down
92 changes: 0 additions & 92 deletions fixtures/hasura/chinook/metadata/chinook-types.hml

This file was deleted.

2 changes: 1 addition & 1 deletion fixtures/hasura/chinook/metadata/commands/InsertArtist.hml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ definition:
inputTypeName: InsertArtistInput
fields:
- name: ok
type: Chinook_Double!
type: Float!
- name: n
type: Int!
dataConnectorTypeMapping:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ definition:
outputType: InsertArtist!
arguments:
- name: newPrice
type: Chinook_Decimal!
type: Decimal!
- name: where
type: TrackBoolExp!
type: TrackComparisonExp!
source:
dataConnectorName: chinook
dataConnectorCommand:
Expand Down
47 changes: 26 additions & 21 deletions fixtures/hasura/chinook/metadata/models/Album.hml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ definition:
name: Album
fields:
- name: id
type: Chinook_ObjectId!
type: ObjectId!
- name: albumId
type: Int!
- name: artistId
Expand Down Expand Up @@ -48,28 +48,33 @@ definition:
- title

---
kind: ObjectBooleanExpressionType
kind: BooleanExpressionType
version: v1
definition:
name: AlbumBoolExp
objectType: Album
dataConnectorName: chinook
dataConnectorObjectType: Album
comparableFields:
- fieldName: id
operators:
enableAll: true
- fieldName: albumId
operators:
enableAll: true
- fieldName: artistId
operators:
enableAll: true
- fieldName: title
operators:
enableAll: true
name: AlbumComparisonExp
operand:
object:
type: Album
comparableFields:
- fieldName: id
booleanExpressionType: ObjectIdComparisonExp
- fieldName: albumId
booleanExpressionType: IntComparisonExp
- fieldName: artistId
booleanExpressionType: IntComparisonExp
- fieldName: title
booleanExpressionType: StringComparisonExp
comparableRelationships:
- relationshipName: artist
booleanExpressionType: ArtistComparisonExp
- relationshipName: tracks
booleanExpressionType: TrackComparisonExp
logicalOperators:
enable: true
isNull:
enable: true
graphql:
typeName: AlbumBoolExp
typeName: AlbumComparisonExp

---
kind: Model
Expand All @@ -80,7 +85,7 @@ definition:
source:
dataConnectorName: chinook
collection: Album
filterExpressionType: AlbumBoolExp
filterExpressionType: AlbumComparisonExp
orderableFields:
- fieldName: id
orderByDirections:
Expand Down
40 changes: 22 additions & 18 deletions fixtures/hasura/chinook/metadata/models/Artist.hml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ definition:
name: Artist
fields:
- name: id
type: Chinook_ObjectId!
type: ObjectId!
- name: artistId
type: Int!
- name: name
Expand Down Expand Up @@ -42,25 +42,29 @@ definition:
- name

---
kind: ObjectBooleanExpressionType
kind: BooleanExpressionType
version: v1
definition:
name: ArtistBoolExp
objectType: Artist
dataConnectorName: chinook
dataConnectorObjectType: Artist
comparableFields:
- fieldName: id
operators:
enableAll: true
- fieldName: artistId
operators:
enableAll: true
- fieldName: name
operators:
enableAll: true
name: ArtistComparisonExp
operand:
object:
type: Artist
comparableFields:
- fieldName: id
booleanExpressionType: ObjectIdComparisonExp
- fieldName: artistId
booleanExpressionType: IntComparisonExp
- fieldName: name
booleanExpressionType: StringComparisonExp
comparableRelationships:
- relationshipName: albums
booleanExpressionType: AlbumComparisonExp
logicalOperators:
enable: true
isNull:
enable: true
graphql:
typeName: ArtistBoolExp
typeName: ArtistComparisonExp

---
kind: Model
Expand All @@ -71,7 +75,7 @@ definition:
source:
dataConnectorName: chinook
collection: Artist
filterExpressionType: ArtistBoolExp
filterExpressionType: ArtistComparisonExp
orderableFields:
- fieldName: id
orderByDirections:
Expand Down
Loading

0 comments on commit 888162e

Please sign in to comment.