我的猫鼬模式如下
var ImageFormats = new Schema({
svg : String,
png-xlarge : String,
png-small : String
});
Run Code Online (Sandbox Code Playgroud)
当我将其翻译成 GraphQL 模式时,这就是我尝试的
export var GQImageFormatsType: ObjectType = new ObjectType({
name: 'ImageFormats',
fields: {
svg : { type: GraphQLString },
'png-xlarge': { type: GraphQLString },
'png-small' : { type: GraphQLString }
}
});
Run Code Online (Sandbox Code Playgroud)
GraphQL 返回以下错误: Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "png-xlarge" does not.
如果我尝试在 Mongoose 模型之后对 GraphQL 进行建模,我该如何协调这些字段?有没有办法让我创建别名?
(我在 graffiti 和 stackoverflow 论坛上搜索过这个,但找不到类似的问题)