Tag: graphql-java
-
Dataloader is using only recent context
0 I have defined a custom context as below @Component public class MyContextBuilder implements DgsCustomContextBuilder<MyContexttBuilder.MyContext> { @Override public MyContext build() { return new MyContext(); } public static class MyContext { private String customState = "Custom CID!"; public String getCustomState() { return customState; } public void setCustomState(String state) { customState = state; } } } Datafetcher…
-
Complex type in Netflix dgs entityfetcher
0 I have defined Subgraphs to fetch data from multiple sources type MyResult{ id: ID innerResults: [InnerResult] @external otherResults: [OtherResult] @requires(fields: "innerResults") } DgsEntityFetcher looks like below @DgsEntityFetcher(name = DgsConstants.MYRESULT.TYPE_NAME) public DataFetcherResult<MyResult> getResults(Map<String, Object> values) { values.forEach((k,val) -> log.warn("key {} value{}",k,val)); return DataFetcherResult.<MyResult>newResult() .data(PlacedDeviceResult.newBuilder().Id((String)values.get("id")).innerResults((List<InnerResult>) values.get("innerResults")).build()) .build(); } But this is not working giving exception java.util.LinkedHashMap…
-
Federated Graphql in case of list of items
0 I have defined Subgraphs as below and data is fetched from multiple sources Subgraph A type Query { getAllItems(type: String!) : AllItems } type AllItems{ type: String response: QueryResponse items: [Item!]! pageInfo: Page totalCount: Int } type Item @key(fields: "id") { val1: String val2: String id: ID! } SubgraphB type Item @key(fields: "id") @extends…
-
GraphQlTester or GraphQLTestTemplate is not getting injected With SpringBoot 3.x
0 SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK) @AutoConfigureGraphQlTester class SpaceControllerTest { @Autowired private GraphQlTester graphQlTester; // below the test cases` Throwing exception : Unsatisfied dependency expressed through field ‘graphQlTester’: No qualifying bean of type ‘org.springframework.graphql.test.tester.GraphQlTester’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} I tried working on various options but not getting…
-
Avoiding unnecessary database calls when converting JPA Entity to DTO in Spring Boot with GraphQL
0 I am developing an application using Spring Boot and GraphQL. When returning an Entity directly from GraphQL, data fetchers automatically handle the queries, fetching only the tables requested in the GraphQL query. For instance: query Workspace { workspace { id } } This will only query the workspace table. query Workspace { workspace {…
-
How does GraphQl handle conflicting operation names?
0 Working on a large codebase, I came across 2 exposed graphql mutations with the same name. To my understanding, these should give an error when generating the graphql schema, yet the site is perfectly functional. Both these mutations have the same method arguments as well. I want to know what are the rules on…
-
How to handle security (authn/authz) with DGS Subscriptions and spring security?
0 I’m mirroring a question asked directly on GitHub here. I’m up to the point where if I authorize("/subscriptions",permitAll) while configuring my SecurityWebFilterChain then I can successfully use my subscription queries. However, that removes all the security. I would have liked to do: authorize("/subscriptions",hasAuthority("access")) Anyway, now I need to make sur that the user is…
-
GraphQL field level authorization and nullability
2 We’ve implemented field level authorization in the type resolvers of our server, where a field is only returned with a value if the user has access to it, otherwise "null" is returned (with information in the extensions). The reason why we are not just returning an error (with an empty data response) is that…
-
Apollo parse exception in Android
1 Thanks in advance for help me. In my previous code GraphQL code was working but we want to migrate the Aws Amplify when we added the Amplify after words i am getting the data in interceptor but after that getting exception- "com.apollographql.apollo.exception.ApolloParseException: Failed to parse http response" "Parameter specified as non null is null…
-
Graphqlresolver for common subfield under different parent field type
0 I am new to graphql, I have requirement where multiple different types have the same field which I am fetching from downstream call, can you please suggest how I can write the graphqlresolver for this subfield? { Type1 { title Field1 }, Type2 { Field1 } } here Field1 value I will be getting…