【问题标题】:Validation of properties in GraphQL验证 GraphQL 中的属性
【发布时间】:2017-08-30 00:55:20
【问题描述】:
input MessageInput {
  content: String
  author: String
}

type Message {
  id: ID!
  content: String
  author: String
}

type Query {
  getMessage(id: ID!): Message
}

type Mutation {
  createMessage(input: MessageInput): Message
}

消息内容的最大长度为 255。如何记录最大长度为 255 个字符?如何/在哪里进行此验证?

【问题讨论】:

    标签: graphql graphiql


    【解决方案1】:

    在服务器端,您将在解析器中验证 createMessage 突变。

    我还建议进行某种客户端验证!

    【讨论】:

      猜你喜欢
      • 2011-01-31
      • 2013-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多