Posts

Showing posts with the label graphql

GraphQL - impossibility to Ram-caching data is a big weakness for GraphQL?

GraphQL - impossibility to Ram-caching data is a big weakness for GraphQL? I'm interesting in data query language and seems that jsonApi is dead and now it is graphQL that occupies the scene. But GraphQL doesn't support caching data so I'm wondering if this point is just a dead point for GraphQL since in-memory data [of Apollo or Relay] can't rivalize with HTTP-caching data if I follow some articles written on the web. I see a lot of people beating around the bush. Above any opiniated discussion, concretely in term of performances, this in-memory caching is a dead point for GraphQL ? Or it's okay to run with it ? Thanks 1 Answer 1 GraphQL is a query language (like SQL). It is not concerned with caching as such. It is true that POST requests don't work well with standard HTTP caching, but there are various extensions that enable caching from server-side, e.g. Apollo Engine: ht...

GraphQL Schema for mongoose Mixed type (Schema.Types.Mixed)

GraphQL Schema for mongoose Mixed type (Schema.Types.Mixed) I have a Mongoose schema with the following structure: import mongoose from 'mongoose'; const PropertySchema = new mongoose.Schema({ name: { type: String }, description: { type: String }, value: { type: mongoose.Schema.Types.Mixed }, unit: { type: String }, }); export default mongoose.model('Property', PropertySchema); I need to build a GraphQL query for the given data. How do I handle the Mixed type for the value property ? value Here is my try: import NodeInterface from '../interfaces'; import PropertyModel from '../../models/Property'; const fields = { id: { type: new GraphQLNonNull(GraphQLID), resolve: (obj) => dbIdToNodeId(obj._id, "Property") }, name: { type: GraphQLString }, description: { type: GraphQLString }, value: { type: <<< What ...

SO Relay QueryRenderer - TypeError: this.props.render is not a function

SO Relay QueryRenderer - TypeError: this.props.render is not a function I have a project in React using Redux and Relay . The client connects to an API Server using GraphQL. I was trying to use the component QueryRenderer and I'm getting the following error: TypeError: this.props.render is not a function render src/react-landing/node_modules/react-relay/lib/ReactRelayQueryRenderer.js:164 161 | if (process.env.NODE_ENV !== 'production') { 162 | deepFreeze(renderProps); 163 | } > 164 | return this.props.render(renderProps); 165 | }; 166 | 167 | return ReactRelayQueryRenderer; View compiled finishClassComponent src/react-landing/node_modules/react-dom/cjs/react-dom.development.js:13193 13190 | } else { 13191 | { 13192 | ReactDebugCurrentFiber.setCurrentPhase('render'); > 13193 | nextChildren = instance.render(); 13194 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgr...

LazyInitializationException with graphql-spring

LazyInitializationException with graphql-spring I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY. I am using: https://github.com/graphql-java/graphql-spring-boot and https://github.com/graphql-java/graphql-java-tools for the integration. Here is an example: Entities: @Entity class Show { private Long id; private String name; @OneToMany private List<Competition> competition; } @Entity class Competition { private Long id; private String name; } Schema: type Show { id: ID! name: String! competitions: [Competition] } type Competition { id: ID! name: String } extend type Query { shows : [Show] } Resolver: @Component public class ShowResolver implements GraphQLQueryResolver { @Autowired private ShowRepository showRepository; public List...