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

GraphQLDate inputs cannot be delegated #106

Open
MarkPolivchuk opened this issue Jun 14, 2019 · 0 comments
Open

GraphQLDate inputs cannot be delegated #106

MarkPolivchuk opened this issue Jun 14, 2019 · 0 comments

Comments

@MarkPolivchuk
Copy link

If Service A has a mutation accepting a GraphQLDate input and it needs to delegate or forward that to another Service B with the same signature, the GraphQLDate yyyy-mm-dd string will be converted to a full DateTime string yyyy-mm-ddT00:00:00Z before arriving at Service B which fails validation.

For example, if the same mutation exists both in Service A and Service B, with A delegating the mutation to Service B:

Mutation {
  updateUser(input: UserInput!): User!
}

type User {
  id: ID!
  dob: GraphQLDate!
}

input UserInput {
  id: ID!
  dob: GraphQLDate!
}

And a client mutates Service A with the following

mutation updateUser($input: UserInput) {
  updateUser(input: $input) {
    id
    dob
  }
}

{
  "input": {
    "id": "1234",
    "dob": "2000-01-01"
  }
}

When service B receives the mutation, it will see the following as the input because it is being parsed to a JS Date object in service A:

{
  "input": {
    "id": "1234",
    "dob": "2000-01-01T00:00:00Z"
  }
}

Which fails validation.

You are already stripping the time component when serializing the GraphQL date. Can we do the same when parsing so that values can be passed from service to service?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant