简体   繁体   English

在 GraphQL 架构中使用 Int 作为名称

[英]Using Int as name in GraphQL Schema

So, I was creating a graphql schema,所以,我正在创建一个 graphql 模式,

type Details {
1: User!
2: User!
3: User!
id: String!
item: String!
}

What I want is to use the Int (1, 2, 3) in my Schema but not sure how.我想要的是在我的架构中使用 Int (1, 2, 3) 但不确定如何使用。 Someone must have been in the same situation before, help me figure it out.以前肯定有人遇到过同样的情况,帮我弄清楚。

Names in GraphQL can include numbers, but they cannot start with a number. GraphQL 中的名称可以包含数字,但不能以数字开头。

If you need to map over an existing API that returns numbers as fields, you can do a mapping such as this one: Graphql: How to map fields that start with number如果您需要 map 超过现有的 API 将数字作为字段返回,您可以进行如下映射: Graphql:How to map fields that start with number

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM