Releases: typelevel/grackle
v0.23.0
What's Changed
-
Modularised and added Oracle and SQL Server backends by @milessabin in #675
- Split
sql
module intosql-core
andsql-pg
, the latter containing Postgres specfics shared bydoobie-pg
andskunk
. - Split off
doobie-core
fromdoobie-pg
removing all Postgres specfics from the former. - Factored out all Postgres specifics from
SqlMapping
. - Added Oracle backend.
- Added SQL Server backend.
- Reduced the use of lateral subqueries to a minimum.
- Simplified
SqlSelect
nesting logic. - Avoid nested conditions being captured by predicate subqueries.
- Replaced
whale-tail
with call outs todocker-compose
allowing container to be shared by all suites across multiple test runs.
Running tests (eg.
rootJVM/test
) will automatically spin up the relevant containers, which will stay up and can be reused across multiple tests runs, significantly speeding up the test cycle. I recommend runningallUp
initially, to pull images and initialise databases, before running tests the first time. Note that Oracle in particular takes quite a long time to initialise, so expectallUp
to take several minutes to complete the first time around.There have been some changes in compilation of queries for Postgres, primarily a reduction in the usage of lateral subqueries (partly to simplify the implementation for SQL Server, which has a subtly different mechanism for achieving similar effects). These changes should preserve expected results, and reports of any changes in behaviour, including performance regressions, would be very much appreciated.
- Split
Updates
- Added checks for exit code 0 by @phdoerfler in #679
- Update sbt-typelevel, sbt-typelevel-site to 0.7.4 by @typelevel-steward in #664
- Update sbt-scoverage to 2.2.2 by @typelevel-steward in #668
- Update http4s-circe, http4s-dsl, ... to 0.23.29 by @typelevel-steward in #670
- Update logback-classic to 1.5.12 by @typelevel-steward in #671
- Update sbt-buildinfo to 0.13.1 by @typelevel-steward in #677
- Update cats-effect to 3.5.7 by @typelevel-steward in #682
- Update sbt, scripted-plugin to 1.10.6 by @typelevel-steward in #683
Full Changelog: v0.22.0...v0.23.0
v0.22.0
What's Changed
- Fix for polymorphic fields in SqlMapping by @milessabin in #634
Updates
- Update sbt-scoverage to 2.2.0 by @typelevel-steward in #653
- Update http4s-circe, http4s-dsl, ... to 0.23.28 by @typelevel-steward in #654
Full Changelog: v0.21.0...v0.22.0
v0.21.0
What's Changed
- Tidied up demo project by @milessabin in #636
- Added some ResultT constructors by @tpolecat in #644
- Preserve internal error by @tpolecat in #646
- Make effect elaborator respect predicated mappings by @tpolecat in #650
Updates
- Update scala-java-time to 2.6.0 by @typelevel-steward in #632
- Update flyway-database-postgresql to 10.15.0 by @typelevel-steward in #633
- Update circe-core, circe-generic, ... to 0.14.8 by @typelevel-steward in #635
- Update sbt-scoverage to 2.1.0 by @typelevel-steward in #639
- Update sbt to 1.10.1 by @typelevel-steward in #640
- Update whale-tail-manager to 0.0.12 by @typelevel-steward in #643
- Update sbt-typelevel, sbt-typelevel-site to 0.7.2 by @typelevel-steward in #641
- Update logback-classic to 1.5.7 by @typelevel-steward in #645
- Update sbt-scoverage to 2.1.1 by @typelevel-steward in #648
- Update fs2-core, fs2-io to 3.11.0 by @typelevel-steward in #649
- Update sbt-typelevel, sbt-typelevel-site to 0.7.3 by @typelevel-steward in #651
- Update logback-classic to 1.5.8 by @typelevel-steward in #652
Full Changelog: v0.20.0...v0.21.0
v0.20.0
What's Changed
- Reworked interfaces and implementations by @milessabin in #631
- Object type fields mapped at the interface level and interface type fields which are implemented or overridden at the object type level are now explicitly represented internally. This allows both more efficient lookup of inherited field mappings and correct lookup of overriden field mappings.
- Field mapping lookup is now more effectively indexed in
TypeMappings
. This might give a noticeable performance improvement forValueMapping
. Now that this indexing in centralised inTypeMappings
, the per-ObjectMapping
field indices have been removed. If this proves problematic for applications it could be reinstated. - Schema validation now enforces the uniqueness of interfaces in
implements
clauses. - Schema validation now enforces that object and interface types must directly implement all transitively implemented interfaces. The
allInterfaces
method onInterfaceType
has been deprecated because with the preceding validation change it is equivalent tointerfaces
. - Mapping validation now ensures that discriminator attributes for
SqlInterfaceMapping
are not polymorphic. - The
Mapping
-specific logic ofmkCursorForField
has been extracted tomkCursorForMappedField
allowing simpler mapping-specific implementations. - Previously introspection did not report interfaces implemented by interfaces.
- Added
Schema#implementations
which returns the implementing object types of an interface. - The
unsafe
TypeMappings
constructor has been deprecated and renamed tounchecked
. TypeMappings#unsafe
has been renamed tounchecked
and hidden.- The implementations of
hasField
,nullableHasField
,hasPath
andhasListPath
inCursor
had incorrect semantics and appear to be unused, so rather than fix them, they have been removed. - Various tests have been updated to conform to the newly implemented validation rules and changes to field mapping lookup.
Updates
- Update munit-cats-effect to 2.0.0 by @typelevel-steward in #626
- Update cats-core, cats-laws to 2.11.0 by @typelevel-steward in #627
- Update flyway-database-postgresql to 10.14.0 by @typelevel-steward in #629
Full Changelog: v0.19.1...v0.20.0
v0.19.1
What's Changed
- Fix handling of introspection types in inline fragments by @milessabin in #623
- Bring docs into line with Typelevel organisation Code of Conduct by @milessabin in #620
Updates
- Update skunk-circe, skunk-core to 0.6.4 by @typelevel-steward in #618
- Update flyway-database-postgresql to 10.13.0 by @typelevel-steward in #619
- Update shapeless to 2.3.11 by @typelevel-steward in #621
Full Changelog: v0.19.0...v0.19.1
v0.19.0
Main Changes
Reworked mapping management and validation by @milessabin in #608
-
The collection of type mappings has moved to a new first class
TypeMappings
container type. There is an implicit conversion fromList[TypeMapping]
toTypeMappings
, so this is a source compatible change (this will probably be deprecated in a later release). Most mapping validation logic has been moved toTypeMappings
, apart from mapping-specific rules (eg. forSqlMapping
) which are delegated to the relevantMapping
subtype at the granularity of validity for individual type and field mappings.Switching to the new API involves changing initialisations of the form,
object SomeMapping extends ... { val schema = ... val typeMappings = List( ObjectMapping( tpe = SomeType, fieldMappings = List( SomeFieldMapping(...), ... ) ), ... ) }
to,
object SomeMapping extends ... { val schema = ... val typeMappings = TypeMappings( ObjectMapping(SomeType)( SomeFieldMapping(...), ... ), ... ) }
While the current form is still supported, switching to the new form is encouraged to enable use of the new
MappingPredicates
. -
Added
MappingPredicate
as an extensible mechanism for matching mappings to paths.TypeMatch
replaces the existingType
linked association,PrefixedTypeMatch
replaces thePrefixedMapping
wrapper, andPathMatch
corresponds to the theSwitchTypeMapping
used by Gemini/Aura.PrefixedMapping
is still available in source compatible form, however the new form is encouraged.PrefixedMappings
of the form,PrefixedMapping( tpe = SomeType mappings = List( List("some", "path") -> ObjectMapping( tpe = SomeType, fieldMappings = List(...) ), ) )
should be changed to,
ObjectMapping(PrefixedTypeMatch(List("some", "path"), SomeType))( SomeFieldMapping(...), ... )
Alternatively, using the new
PathMatch
predicate, which matches contexts with a path leading from some enclosing type,ObjectMapping(PathMatch(SomeParentType / "some" / "path"))( SomeFieldMapping(...), ... )
or more concisely,
ObjectMapping(SomeParentType / "some" / "path")( SomeFieldMapping(...), ... )
-
Mapping validation is now performed by default unless explicitly disabled. Validation is deferred until the mappings compiler is first referenced (to avoid init-order issues, object initialization errors and poor interactions of the latter with munit-cats-effect) and is performed exactly once. Applications which have at least one query unit test will trigger validation failures automatically at test time.
While upgrading applications to this version, it might be desirable to temporarily suppress automatic validation. To do this, an existing list of type mappings can be wrapped in the
TypeMappings.unsafe
constructor,object SomeMapping extends ... { val schema = ... val typeMappings = TypeMappings.unsafe( List( ObjectMapping( tpe = SomeType, fieldMappings = List( SomeFieldMapping(...), ... ) ), ... ) ) }
-
The validation algorithm has been reworked to start from the GraphQL schema and generate an exhaustive set of paths which are used to determine the relevant mappings to check against GraphQL and DB schema types. This supports both traversal through mappings which are partly implicit (eg. the Circe and Generic mappings) and also accommodate mappings which are guarded by
MappingPredicates
. -
The base mapping validator now also reports unused (ie. not reachable via any valid path in the GraphQL schema) type and field mappings, and ambiguities where multiple mappings of the same specificity match the same path.
-
The SQL mapping validator checks that,
- Nullability and Scala type are consistent between GraphQL and SQL.
- Choice of
Leaf
orObjectMapping
is consistent with GraphQL leaf or non-leaf types. - GraphQL object types, interfaces, implementation and union members are nested within single a single DB table.
- Associative fields are also keys.
- Union field mappings must be hidden and leaf.
- Embedded subobjects must be nested in their parent object DB table.
- Joins must have at least one join condition.
- Parallel joins must relate the same DB tables.
- Serial joins must chain correctly.
-
Type mappings with non-trivial predicates are now indexed.
-
LeafMapping
now supportsMappingPredicates
and are indexed along withObjectMappings
. -
Built-in Scalar types now have explicit
LeafMappings
and can now be specialized for particular contexts viaMappingPredicates
. -
Added a
subtree
Boolean attribute toFieldMapping
to signal that a field value can represent structured result subtrees which are not explicitly mapped at all levels. This allows mapping validation to include the Circe and Generic mappings which implicitly map subtrees. -
ValueObjectMapping
has a newon
constructor and thewithParent
initializer method, which was present on all field mappings has been removed and replaced by theValueFieldMapping
specificunwrap
.The existing API is still supported, however moving to the new API is encouraged because it supports the use of
MappingPredicates
. To switch, mappings of the following form,ValueObjectMapping[Foo]( tpe = FooType, fieldMappings = List( ValueField(...), ... ) )
should be changed to,
ValueObjectMapping(FooType).on[Foo]( ValueField(...), ... )
-
The
Path
type now supports narrowing GraphQL interface and union types along path. This allows thePathMatch
mapping predicate to match mapping which are reachable from a base type along a path which passes through fields which have interface or union type fields. Narrowing is specified using the new%
element as follows,SomeType / "interfaceField" % ImplementingType / "implementorSpecificField"
Other changes
- Switched to Typelevel Code of Conduct by @valencik in #586
- Cursors resolve fields internally before searching other mappings by @milessabin in #565
- Preserve field order when merging fragments by @milessabin in #571
- Fixed unused fragments computation by @milessabin in #566
- Corrected test for fragments applicability by @umazalakain in #594
- Fragments can now be applied to union types; schema validation is tightened to reject interfaces in unions by @milessabin in #592
- Tightened up usage of TypeRef by @milessabin in #557
- Added stack trace printing to demo project by @phdoerfler in #581
- Fix operation error message and add tests by @milessabin in #582
- Fix SLF4J warnings for skunk tests by @milessabin in #605
New Contributors
- @phdoerfler made their first contribution in #581
- @valencik made their first contribution in #586
- @umazalakain made their first contribution in #594
Full Changelog: v0.18.1...v0.19.0
v0.18.1
Main Changes
- Fully implement field selection merging and collection rules by @milessabin in #550
- Added test verifying serial execution by @milessabin in #551
- Add talks link by @jatcwang in #536
Other Changes
- Update flyway-database-postgresql to 10.4.0 by @typelevel-steward in #537
- Update flyway-database-postgresql to 10.4.1 by @typelevel-steward in #538
- Update http4s-circe, http4s-dsl, ... to 0.23.25 by @typelevel-steward in #539
- Update sbt-typelevel, sbt-typelevel-site to 0.6.5 by @typelevel-steward in #540
- Update shapeless3-deriving to 3.4.0 by @typelevel-steward in #541
- Update flyway-database-postgresql to 10.5.0 by @typelevel-steward in #542
- Update sbt-scalajs, scalajs-compiler, ... to 1.15.0 by @typelevel-steward in #543
- Update shapeless3-deriving to 3.4.1 by @typelevel-steward in #544
- Update cats-effect to 3.5.3 by @typelevel-steward in #545
- Update flyway-database-postgresql to 10.6.0 by @typelevel-steward in #546
- Update nscplugin, sbt-scala-native, ... to 0.4.17 by @typelevel-steward in #547
- Update fs2-core, fs2-io to 3.9.4 by @typelevel-steward in #548
- Update skunk-circe, skunk-core to 0.6.3 by @typelevel-steward in #549
New Contributors
Full Changelog: v0.18.0...v0.18.1
v0.18.0
This security release addresses GHSA-g56x-7j6w-g8r8.
Full Changelog: v0.17.2...v0.18.0
v0.17.2
What's Changed
- fixing "TIMESTAMP WITH TIMEZONE" typo by @michludw in #534
- Update sbt to 1.9.8 by @typelevel-steward in #532
- Update sbt-typelevel, sbt-typelevel-site to 0.6.4 by @typelevel-steward in #533
- Update flyway-database-postgresql to 10.3.0 by @typelevel-steward in #535
Full Changelog: v0.17.1...v0.17.2
v0.17.1
What's Changed
- Elaborate introspection in out of line fragments by @milessabin in #521
- Tweak to some collections usage by @danicheg in #525
- support for scalar argument without apostrophes by @michludw in #529
- Ensure select columns are distinct in all cases by @milessabin in #530
- Fix for fragments with supertype refinements by @milessabin in #531
- Update logback-classic to 1.4.12 by @typelevel-steward in #522
- Update logback-classic to 1.4.13 by @typelevel-steward in #523
- Update logback-classic to 1.4.14 by @typelevel-steward in #524
- Update sbt-typelevel, sbt-typelevel-site to 0.6.3 by @typelevel-steward in #526
- Update flyway-database-postgresql to 10.2.0 by @typelevel-steward in #527
- Update sbt-jmh to 0.4.7 by @typelevel-steward in #528
New Contributors
Full Changelog: v0.17.0...v0.17.1