-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switching createGraphQLEnumTypes and createGraphQLDirectiveTypes to a…
…llow EnumTypes directive arguments
- Loading branch information
Showing
6 changed files
with
91 additions
and
1 deletion.
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
9 changes: 9 additions & 0 deletions
9
...lementation/src/test/java/io/smallrye/graphql/schema/directiveswithenumvalues/MyEnum.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,9 @@ | ||
package io.smallrye.graphql.schema.directiveswithenumvalues; | ||
|
||
import io.smallrye.graphql.schema.EnumDirective; | ||
|
||
@EnumDirective | ||
public enum MyEnum { | ||
SOME, | ||
THING | ||
} |
18 changes: 18 additions & 0 deletions
18
...c/test/java/io/smallrye/graphql/schema/directiveswithenumvalues/MyEnumValueDirective.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,18 @@ | ||
package io.smallrye.graphql.schema.directiveswithenumvalues; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import org.eclipse.microprofile.graphql.NonNull; | ||
|
||
import io.smallrye.graphql.api.Directive; | ||
import io.smallrye.graphql.api.DirectiveLocation; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Directive(on = DirectiveLocation.FIELD_DEFINITION) | ||
public @interface MyEnumValueDirective { | ||
|
||
@NonNull | ||
MyEnum value(); | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...mentation/src/test/java/io/smallrye/graphql/schema/directiveswithenumvalues/MyObject.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,21 @@ | ||
package io.smallrye.graphql.schema.directiveswithenumvalues; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.microprofile.graphql.NonNull; | ||
|
||
public class MyObject { | ||
|
||
@NonNull | ||
@MyEnumValueDirective(MyEnum.SOME) | ||
String name; | ||
|
||
public MyObject(String name) { | ||
this.name = Objects.requireNonNull(name); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...ementation/src/test/java/io/smallrye/graphql/schema/directiveswithenumvalues/SomeApi.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,12 @@ | ||
package io.smallrye.graphql.schema.directiveswithenumvalues; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
|
||
@GraphQLApi | ||
public class SomeApi { | ||
@Query | ||
public MyObject getMyObject() { | ||
return new MyObject("Test"); | ||
} | ||
} |