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

Apollo server 2.x #18

Open
meodemsao opened this issue Nov 16, 2019 · 0 comments
Open

Apollo server 2.x #18

meodemsao opened this issue Nov 16, 2019 · 0 comments

Comments

@meodemsao
Copy link

meodemsao commented Nov 16, 2019

Seem not work with apollo server 2.x

I config like document but not return any error

schema.graphql

directive @constraint(
  minLength: Int
  maxLength: Int
  startsWith: String
  endsWith: String
  contains: String
  notContains: String
  pattern: String
  format: String
  differsFrom: String
  min: Float
  max: Float
  exclusiveMin: Float
  exclusiveMax: Float
  notEqual: Float
) on ARGUMENT_DEFINITION

category.grapqhl

type Query {
  category(id: ID!): Category
  categories(
    where: JSON
    limit: Float @constraint(min: 1, max: 10)
    offset: Int
    order: String
  ): [Category!]
  categoriesConnection(
    where: JSON
    first: Int!
    last: Int
    after: String
    before: String
  ): CategoryConnection!
}
import { resolver, createConnectionResolver } from 'graphql-sequelize'

export default {
  category: resolver((parent, args, context, info) => context.models.Category),

  categories: resolver((parent, args, context, info) => context.models.Category),

  categoriesConnection: createConnectionResolver({
    target: (parent, args, context, info) => context.models.Category,
    where: (findOptions, args) => args
  }).resolveConnection
}

my query in playground

query{
 	categories(limit: 15){
    id
    name
  }
}

and graphql still return right data not validate limit arg

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

No branches or pull requests

1 participant