刚开始学习理性反应,并与尝试读取 ENUM 值的 graphql 设置作斗争。
设置
- 理性反应
- 阿波罗graphql
- graphql_ppx
- github graphql 端点
我正在通过 github api 获取最新的拉取请求数据并读取status
作为枚举并在 gql 文档中定义为的属性:
- 打开
- 关闭
- 合并
检查网络选项卡,我看到状态是作为字符串接收的。在应用程序中,当我记录字段时,我得到一堆反映值的整数。smb 可以解释一下,我如何将数据作为字符串“打印”到我的视图中,以及为什么将它们转换为整数?是否有某种生成的类型可以用于变体开关?
let stateEnum = data->map(node => node##state);
Js.log(stateEnum) // possible values: 880069578, 982149804 or -1059826260
// somehow switch these values here?! :)
// current type of `stateEnum` is option('a)
非常感谢您,祝您有美好的一天!