2017-08-29 44 views
0
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中驗證屬性

回答

0

在服務器端,您將在解析器中驗證createMessage突變。

我也建議進行某種客戶端驗證!