-
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.
Add autodetect federation directives in gradle plugin
- Loading branch information
Showing
9 changed files
with
182 additions
and
17 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...adle-plugin/plugin/src/main/java/io/smallrye/graphql/gradle/tasks/FederationDotNames.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.smallrye.graphql.gradle.tasks; | ||
|
||
import io.smallrye.graphql.api.federation.Authenticated; | ||
import io.smallrye.graphql.api.federation.ComposeDirective; | ||
import io.smallrye.graphql.api.federation.Extends; | ||
import io.smallrye.graphql.api.federation.External; | ||
import io.smallrye.graphql.api.federation.Inaccessible; | ||
import io.smallrye.graphql.api.federation.InterfaceObject; | ||
import io.smallrye.graphql.api.federation.Key; | ||
import io.smallrye.graphql.api.federation.Override; | ||
import io.smallrye.graphql.api.federation.Provides; | ||
import io.smallrye.graphql.api.federation.Requires; | ||
import io.smallrye.graphql.api.federation.Shareable; | ||
import io.smallrye.graphql.api.federation.Tag; | ||
import io.smallrye.graphql.api.federation.link.Link; | ||
import io.smallrye.graphql.api.federation.policy.Policy; | ||
import io.smallrye.graphql.api.federation.requiresscopes.RequiresScopes; | ||
import org.jboss.jandex.DotName; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public final class FederationDotNames { | ||
public static final List<DotName> FEDERATION_DIRECTIVES_NAMES; | ||
|
||
static { | ||
FEDERATION_DIRECTIVES_NAMES = new ArrayList<>(); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Authenticated.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(ComposeDirective.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Extends.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(External.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Inaccessible.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(InterfaceObject.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Key.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Override.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Provides.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Requires.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Shareable.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Tag.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Link.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(Policy.class)); | ||
FEDERATION_DIRECTIVES_NAMES.add(DotName.createSimple(RequiresScopes.class)); | ||
} | ||
} |
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
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
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
22 changes: 21 additions & 1 deletion
22
tools/gradle-plugin/testing-project/src/main/java/org/acme/Foo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
package org.acme; | ||
|
||
import io.smallrye.graphql.api.federation.FieldSet; | ||
import io.smallrye.graphql.api.federation.Key; | ||
|
||
@Key(fields = @FieldSet("id")) | ||
public class Foo { | ||
private Integer id; | ||
|
||
private Integer number; | ||
|
||
public Foo() { | ||
} | ||
|
||
public Foo(Integer id, Integer number) { | ||
this.id = id; | ||
this.number = number; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public Integer getNumber() { | ||
return number; | ||
} | ||
|
||
public void setNumber(Integer number) { | ||
this.number = number; | ||
} | ||
} | ||
} |
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