You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring for GraphQL is, in contrast to other GraphQL technologies that surface persistent
484
-
data, not a data gateway that translates GraphQL queries into SQL or JSON queries.
485
-
Instead, Spring for GraphQL is an API gateway that leverages existing Spring technology
486
-
following common programming models to expose underlying data sources through GraphQL.
487
-
488
-
Domain-driven design is the suggested approach to manage complexity when using Spring Data.
489
-
So by design, a GraphQL API built on top of Spring Data can leverage only what's already
490
-
provided by an application.
491
-
It, therefore, must adhere to the constraints of an aggregate.
492
-
By definition, an aggregate is only valid if it is loaded in its entirety.
493
-
Partially loaded aggregates may impose a limitation on aggregate functionality.
494
-
495
-
With Spring Data you can choose whether you want to let your aggregate participate as
496
-
an underlying data model to be directly exposed as a GraphQL result, or whether you want to
497
-
apply projections to your data model before returning it as a GraphQL operation result.
498
-
499
-
The advantage of using aggregates is that you do not require additional code to expose
500
-
data through repositories. When processing a GraphQL operation, the integration layer
501
-
transforms the field selection set into property paths. It provides these hints of which
502
-
properties to materialize to the underlying Spring Data module that limits the field
503
-
(or column) selection.
504
-
505
-
Sometimes, an already reduced set of fields can be useful when exposing data. Also, some
506
-
arrangements might require transformations to be applied before data is returned for a
507
-
GraphQL operation. Spring Data supports for these scenarios projections: Interface and DTO
508
-
Projections.
483
+
Spring for GraphQL lets you leverage existing Spring technology, following common
484
+
programming models to expose underlying data sources through GraphQL.
509
485
510
-
Interface projections define a fixed set of properties to expose. Properties may or may
511
-
not be `null`, depending on the query result. A plain, https://docs.spring.io/spring-data/commons/docs/current/reference/html/#projections.interfaces.closed[closed interface projection]
512
-
can be useful if you cannot partially materialize the aggregate object but you still
513
-
want to expose a subset of properties.
514
-
515
-
You can use interface projections to apply a lightweight set of data transformations,
516
-
such as concatenations, computations or applying a static function to a property.
0 commit comments