Skip to content

Stack overflow in fieldsConverter #20

@markacola

Description

@markacola

Given the following schema, with a recursive document array, we get a stack overflow within the lib/fieldsConverter.js file.
code:

const Schema = new mongoose.Schema({
  sometype: String
});
Schema.add({ recursiveType: [Schema] });

error:

.../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:149
  var typeComposer = new _graphqlCompose.TypeComposer(_typeStorage2.default.getOrSet(typeName, new _graphql.GraphQLObjectType({
                                                                                                           ^
RangeError: Maximum call stack size exceeded
    at convertModelToGraphQL (.../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:149:108)
    at documentArrayToGraphQL (.../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:346:22)
    at convertFieldToGraphQL (.../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:218:14)
    at .../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:162:13
    at Array.forEach (native)
    at convertModelToGraphQL (.../node_modules/graphql-compose-mongoose/lib/fieldsConverter.js:159:39)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions