GraphQL HotChocolate Adding PaginationAmountType converts my int's to PaginationAmmount

Viewed 521

when i add the PaginationAmmountType to set the max records per page all of my models int variables get turrned into PaginatioAmount

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

this is how it looks without the PaginationAmountType

and then this is what it changes to when i add the PaginationAmountType

enter image description here

How can i resolve this or what exactly am i doing wrong i need to specify a max amount of records per page but this method of doing so is messing up my models.

1 Answers

I think the problem is that PaginationAmount is also based on IntType. The schema discovers the PaginationType and binds it to the int type

Can you try this:

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

Btw. we released Version 11. It brings a lot on new features and improvements. We also dropped the PaginationAmountType completely.

Check out the migration Guide: https://chillicream.com/docs/hotchocolate/api-reference/migrate-from-10-to-11/

Related