GraphQL Schema for Mixed Type Processing

I recently started exploring the possibility of using GraphQL to query dynamic data configurations. The very first thing that jumps at me is the strongly typed GraphQL concept.

Is there a way for GraphQL schemas to process arrays of mixed type objects? I would really appreciate an explanation or a possible link that I can read.

I am currently working with GraphQL with Node.js, but a later implementation will be from the Java Container. All data will be JSON pulled from MongoDB.

+5
source share
3 answers

, , .

- : , , . .

: , . , / , /.

, , .. . , JSON (.. JSON ). , , ( ).

+1

If the data is fully in JSON format and you prefer to save it as it is, check the scalar type of JSON . Basically,

import { GraphQLObjectType } from 'graphql';
import GraphQLJSON from 'graphql-type-json';

export default new GraphQLObjectType({
  name: 'MyType',
  fields: {
    myField: { type: GraphQLJSON },
  },
});
0
source

Source: https://habr.com/ru/post/1619570/


All Articles