-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/maven/version.smallrye-context-pr…
…opagation-2.0.0
- Loading branch information
Showing
39 changed files
with
488 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Federation | ||
|
||
To enable support for [GraphQL Federation](https://www.apollographql.com/docs/federation), simply set the `smallrye.graphql.federation.enabled` config key to `true`. | ||
|
||
You can add the Federation directives by using the equivalent Java annotation, e.g. to extend a `Product` entity with a `price` field, you can write a class: | ||
|
||
```java | ||
package org.example.price; | ||
|
||
import org.eclipse.microprofile.graphql.Id; | ||
|
||
import io.smallrye.graphql.api.federation.Extends; | ||
import io.smallrye.graphql.api.federation.Key; | ||
|
||
@Extends @Key(fields = "id") | ||
public class Product { | ||
@Id | ||
private String id; | ||
|
||
@Description("The price in cent") | ||
private Integer price; | ||
|
||
// getters and setters omitted | ||
} | ||
``` | ||
|
||
And a normal query method that takes the `key` fields as a parameter and returns the requested type: | ||
|
||
```java | ||
package org.example.price; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Id; | ||
import org.eclipse.microprofile.graphql.Query; | ||
|
||
@GraphQLApi | ||
public class Prices { | ||
@Query | ||
public Product product(@Id String id) { | ||
return ...; | ||
} | ||
} | ||
``` | ||
|
||
The GraphQL Schema then contains: | ||
|
||
```graphql | ||
type Product @extends @key(fields : ["id"]) { | ||
id: ID | ||
price: Int | ||
} | ||
|
||
union _Entity = Product | ||
|
||
type Query { | ||
_entities(representations: [_Any!]!): [_Entity]! | ||
_service: _Service! | ||
product(id: ID): Product | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...llrye/graphql/federation/api/Extends.java → ...llrye/graphql/api/federation/Extends.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lrye/graphql/federation/api/External.java → ...lrye/graphql/api/federation/External.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../smallrye/graphql/federation/api/Key.java → .../smallrye/graphql/api/federation/Key.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lrye/graphql/federation/api/Provides.java → ...lrye/graphql/api/federation/Provides.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lrye/graphql/federation/api/Requires.java → ...lrye/graphql/api/federation/Requires.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
server/federation/api/src/main/java/io/smallrye/graphql/federation/api/FederatedSource.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.