Skip to content

Using graphql-iso-date and custom scalars #38

@vonazt

Description

@vonazt

I've been trying to use the graphql-iso-date package with graphql-s2s for DateTime formatting on types and get this error:
TypeError: Cannot read property 'directive' of null

Is this a known issue, or is there a workaround? My typeDefs file looks like this:

export const commonTypeDefs = `
scalar DateTime

type Timestamps {
  created: DateTime
  started: DateTime
  modified: DateTime
  completed: DateTime
}`

resolvers:

import { GraphQLDateTime } from "graphql-iso-date"

export const resolvers = {
  DateTime: GraphQLDateTime,
  Query: {
   ...
    }

and my index merging:

import { makeExecutableSchema } from 'graphql-tools'
import commonTypeDefs from './commonTypeDefs'
const { transpileSchema } = require('graphql-s2s').graphqls2s

import typeDefs from './typeDefs.gql'
import { resolvers } from './resolvers'

export const workSchema = makeExecutableSchema({
  typeDefs: [transpileSchema(commonTypeDefs), typeDefs],
  resolvers
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions