-
Notifications
You must be signed in to change notification settings - Fork 4
chore: example for setters argument for @rest directive #68
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
Signed-off-by: asararatnakar <[email protected]>
Signed-off-by: asararatnakar <[email protected]>
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.
Snippets are meant to be focused on a single concept, so I think here the concept of a transformation followed by a setter will just confuse.
I would instead have a simulated response and just use setters to pull the data from that response.
Signed-off-by: asararatnakar <[email protected]>
Signed-off-by: asararatnakar <[email protected]>
Signed-off-by: asararatnakar <[email protected]>
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.
Some minor changes would be good.
transforms/setters/api.graphql
Outdated
@@ -0,0 +1,41 @@ | |||
# This example demonstartes mapping a JSON response to the fields of the GraphQL. |
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.
typo "demonstartes"
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.
"of a GraphQL object"
@@ -0,0 +1,41 @@ | |||
# This example demonstartes mapping a JSON response to the fields of the GraphQL. | |||
|
|||
type Customer { |
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.
Actually, can we have the GraphQL object have the natural names and the response have "weird" names
transforms/setters/api.graphql
Outdated
setters: [ | ||
{ field: "cId", path: "id" } # JSON response field 'id' is mapped to GraphQL 'cId' | ||
{ field: "cName", path: "name" } # JSON response field 'name' is mapped to GraphQL 'cName' | ||
{ field: "cAddress", path: "address" } # JSON response field 'address' mapped to GraphQL 'cAddress' |
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.
Can we add one with a nested path, to show that is supported, e.g.
{ field: "address", path: "location.address" }
Signed-off-by: asararatnakar <[email protected]>
Signed-off-by: asararatnakar <[email protected]>
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.
GTG
example to demonstrate setters argument for the directive @rest