Skip to content
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

createdAt and updatedAt which are available on REST aren't available on GraphQL #119

Open
flowersinthesand opened this issue Nov 10, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@flowersinthesand
Copy link
Contributor

Using example-api-gateway I found that items returned by REST API have createdAt and updatedAt value.

➜  example-api-gateway git:(master) ✗ curl http://localhost:4000/api-gateway/polls\?limit\=2\&after\=0         {"total":37,"items":[{"id":"1","name":"Dynamic Configuration Agent","body":"Et odit ullam nam ut. Totam quia deleniti quia. Omnis voluptas quidem dolorum officia est harum culpa.","createdAt":"2020-11-10T04:58:15.980Z","updatedAt":"2020-11-10T04:58:15.980Z"},{"id":"2","name":"Internal Paradigm Officer","body":"Ratione itaque nam eum tenetur architecto rerum dolore earum rerum. Explicabo eum mollitia qui beatae modi nihil et ipsa. Doloremque eveniet itaque nesciunt quo consectetur qui. Et nam saepe porro. Maxime autem nesciunt eum rerum iure. Hic accusamus unde atque veritatis reiciendis.","createdAt":"2020-11-10T04:58:17.974Z","updatedAt":"2020-11-10T04:58:17.974Z"}]}%                                           

However, these date values are not defined in GraphQL schema so if I include createdAt and updatedAt in a GraphQL query it throws the following error:

➜  example-api-gateway git:(master) ✗ curl --request POST --header "Content-Type: application/json" --data '{"query":"{queryPoll(first: 25) {edges {node {id name body createdAt updatedAt}}}}"}' http://localhost:4000/graphql

{"errors":[{"message":"Cannot query field \"createdAt\" on type \"Poll\".","locations":[{"line":1,"column":50}]},{"message":"Cannot query field \"updatedAt\" on type \"Poll\".","locations":[{"line":1,"column":60}]}]}

Personally I prefer to add createdAt and updatedAt fields to GraphQL interface too for convenience.

@manh-vv manh-vv added the bug Something isn't working label Nov 17, 2020
@manh-vv manh-vv removed their assignment Nov 17, 2020
@flowersinthesand flowersinthesand changed the title createdAt and updatedAt which are available on RESET aren't available on GraphQL createdAt and updatedAt which are available on REST aren't available on GraphQL Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants