-
Notifications
You must be signed in to change notification settings - Fork 96
Add directive creation #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
``` | ||
|
||
The name of the directive will be taken from the ``@GraphQLName`` annotation (if not specified, the name will be the class's name). | ||
The description of the directive will be taken from the ``@GraphQLDescription`` annotation's value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be -> is
} | ||
``` | ||
|
||
The name of the directive will be taken from the ``@GraphQLName`` annotation (if not specified, the name will be the class's name). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be -> is
README.md
Outdated
The description of the directive will be taken from the ``@GraphQLDescription`` annotation's value. | ||
The valid locations of the directive (locations which the directive can be applied on) will be taken from ``@DirectiveLocations``. | ||
The arguments of the directive will be taken from the fields defined in the class - notice that you can only use primitive types as arguments of a directive. | ||
For example, we defined an ``isActive`` field - which is boolean, and it's default value is true. That's how the argument of the directive will be defined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's -> its
README.md
Outdated
For example, we defined an ``isActive`` field - which is boolean, and it's default value is true. That's how the argument of the directive will be defined. | ||
You can also use ``@GraphQLName`` and ``@GraphQLDescription`` annotations on the field. | ||
|
||
After you created the class, you will be able to create the ``GraphQLDirective`` object with the following code: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with -> using
README.md
Outdated
} | ||
} | ||
``` | ||
This class turns you string field to upper case if the directive argument "isActive" is set to true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you -> your
if (graphQLNameAnnotation != null) { | ||
return graphQLNameAnnotation.value(); | ||
} | ||
if (annotatedElement instanceof Class<?>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do "else if"
|
||
|
||
public GraphQLArgument getArgument(Field field, Class<?> containingClass) { | ||
GraphQLArgument.Builder builder = newArgument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concatenate all the builder's methods
} | ||
|
||
public GraphQLDirective getDirective(Class<?> annotatedClass) { | ||
GraphQLDirective.Builder builder = newDirective(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concatenate all the builder's methods
No description provided.