chore: example for setters argument for @rest directive#68
Merged
ddebrunner merged 8 commits intomainfrom Feb 14, 2025
Merged
Conversation
ddebrunner
requested changes
Jan 30, 2025
Contributor
ddebrunner
left a comment
There was a problem hiding this comment.
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 <asara.ratnakar@gmail.com>
Signed-off-by: asararatnakar <asara.ratnakar@gmail.com>
Signed-off-by: asararatnakar <asara.ratnakar@gmail.com>
ddebrunner
reviewed
Jan 31, 2025
Contributor
ddebrunner
left a comment
There was a problem hiding this comment.
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. | |||
| @@ -0,0 +1,41 @@ | |||
| # This example demonstartes mapping a JSON response to the fields of the GraphQL. | |||
|
|
|||
| type Customer { | |||
Contributor
There was a problem hiding this comment.
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' |
Contributor
There was a problem hiding this comment.
Can we add one with a nested path, to show that is supported, e.g.
{ field: "address", path: "location.address" }
Signed-off-by: asararatnakar <asara.ratnakar@gmail.com>
Signed-off-by: asararatnakar <asara.ratnakar@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
example to demonstrate setters argument for the directive @rest