GraphQL HotChocolate 添加 PaginationAmountType 将我的 int 转换为 PaginationAmmount

问题描述

当我添加 PaginationAmmountType 来设置每页的最大记录数时,我的所有模型 int 变量都会变成 PaginatioAmount

services.AddGraphQL(SchemaBuilder.New()
                .AddType(new PaginationAmountType(100))
                .AddQueryType<Query>()
                .AddMutationType<Mutation>()
                .AddAuthorizeDirectiveType()
            );

这是没有 PaginationAmountType 的样子

然后这就是当我添加 PaginationAmountType 时它的变化

enter image description here

我该如何解决这个问题,或者我到底做错了什么,我需要指定每页的最大记录数,但这种方法会弄乱我的模型。

解决方法

我认为问题在于 test_list = [0,1,2,3,4,5,6,7,8,9] 也基于 PaginationAmount。架构发现 IntType 并将其绑定到 PaginationType 类型

你能试试这个吗:

int

顺便说一句。我们发布了第 11 版。它带来了很多新功能和改进。我们还完全删除了 PaginationAmountType。

查看迁移指南: https://chillicream.com/docs/hotchocolate/api-reference/migrate-from-10-to-11/

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...