Skip to content

Apollo server 2.x #18

@meodemsao

Description

@meodemsao

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

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