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

GraphQL HotChocolate Adding PaginationAmountType converts my int's to PaginationAmmount

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

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

这是没有 PaginationAmountType 的样子

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

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

我认为问题是 PaginationAmount 也是基于 IntType。模式发现 PaginationType 并将其绑定到 int 类型

你能试试这个吗:

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

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

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