Tag: hotchocolate
-
graph ql code auto generation .net core hot chocolate
0 I am writing an API to fetch data from sql db(about 120+ tables). I have generated model class files automatically. Is there any automatic way to generate Service and Query class files? Right now I am writing these IService and class files. enter image description here enter image description here .net api asp.net-core graphql…
-
How to hide fields for different graphql types which return the same type for GraphQL HotChocolate
1 I created 2 different methods using GraphQL HotChocolate which return the same object type. I need to hide different fields for each method. However, it does not happen when I look at the schema definition. This is an example for code first approach: public class Query { private readonly CharacterRepository _repository; public Query(CharacterRepository repository)…
-
Hot Chocolate GraphQL – MaxExecutionDepth not working
1 How do I get MaxExecutionDepth to work in Hot Chocolate GraphQL? Here is my code: // Add GraphQL Services services.AddGraphQL( SchemaBuilder.New() // enable for authorization support .AddAuthorizeDirectiveType() .ModifyOptions(o => o.RemoveUnreachableTypes = true) .Create() .MakeExecutable( builder => builder .UseDefaultPipeline() .AddErrorFilter<UseExceptionMessageErrorFilter>() .AddOptions( new QueryExecutionOptions() { MaxExecutionDepth = 15 })) .Schema); I’ve tested with this, even changing…
-
HotChocolate v.13 [UseProjections] attribute does not work with DataLoaders
0 I have the following GrapqhQL query: query { listTenants { totalCount items { tenantId name sites { totalCount items { siteId cmxName cmxState hosts( order: { hostId: ASC } where: { hostName: { neq: "ans" } } skip: 4 take: 2 ) { totalCount items { hostId hostName siteId } } } } }…
-
How can I have complex dictionary type attributes
0 I’m using graphql/hotchocolate in my app and I have the following structure: public record PriorInjury(IDictionary<Location, Injure>? Injuries) public record Location(Enums.BodyPart BodyPart, Enums.Side Side, Enums.FrontOrBack FrontOrBack); public record Injure(Enums.PainLevel Level, Enums.HowOftenInjureHurts HowOften, Enums.SinceWhenInjured Since); This is my command: public record AddInjuryCommand(PriorInjury? PriorInjury) : ICommand<Guid>; This code is throwing: InputObject `PriorInjurySortInput` has no fields declared. (HotChocolate.Data.Sorting.SortInputType<PriorInjury>)…
-
Streaming data using HotChocolate GraphQl for .NET project – all results at once instead of one by one problem
2 I’m using C#, .NET7 minimal API and HotChocolate GraphQl. I’m trying to setup graphQl simple query endpoint which will be able to return stream like this: public async IAsyncEnumerable<string> GetDummyNumbers() { for (var i = 0; i < 10; i++) { await Task.Delay(TimeSpan.FromSeconds(1)); yield return i.ToString(); } } It works as is but even…
-
HotChocolate UseSorting doesn’t work on computed fields
0 I have an ItemType defined with some custom fields that are resolved with ResolveWith: public class ItemType : ObjectType<Item> { protected override void Configure(IObjectTypeDescriptor<FilterTreeItem> descriptor) { descriptor .Field(“fullName”) .Type<StringType>() .ResolveWith<Resolver>(r => r.GetFullName(default!)); // Other properties } private class Resolver { public async Task<string> GetFullName([Parent] Item? parent, CancellationToken cancellationToken = default) { return quot;{parent.FirstName} {parent.LastName}”;…
-
hotchocolate schema stitching with another language server
1 I have a question for a custom scalar converter and schema stitching. I want to stitch a schema from a third party Server and from my own server. But the other server uses Java and a "BigDecimal" Type. And when I load the schema in "banana cake pop" or any other UI tool (postman,…