Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded #64

Open
TheBumpaster opened this issue Jun 30, 2023 · 0 comments
Open

RangeError: Maximum call stack size exceeded #64

TheBumpaster opened this issue Jun 30, 2023 · 0 comments

Comments

@TheBumpaster
Copy link

TheBumpaster commented Jun 30, 2023

If the schema contains an array of sub-document schemas I'm getting call stack size exceeded.

Example schema:

const subSchema= new Schema<any>(
    example: {
      type: 'string',
      required: true
    },
  },
  {
    timestamps: false,
    _id: false,
  }
)

const exampleSchema = new Schema<any>(
    subschema: {
      type: [subSchema],
      default: [],
    },
  },
  {
    timestamps: true,
    _id: true,
  }
)
/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:136
const getFieldsFromMongooseSchema = (schema, options) => {
                                    ^

RangeError: Maximum call stack size exceeded
    at getFieldsFromMongooseSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:136:37)
    at mapSchemaTypeToFieldSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:115:26)
    at getFieldsFromMongooseSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:145:23)
    at mapSchemaTypeToFieldSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:115:26)
    at getFieldsFromMongooseSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:145:23)
    at mapSchemaTypeToFieldSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:115:26)
    at getFieldsFromMongooseSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:145:23)
    at mapSchemaTypeToFieldSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:115:26)
    at getFieldsFromMongooseSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:145:23)
    at mapSchemaTypeToFieldSchema (/home/node/app/node_modules/mongoose-to-swagger/dist/index.js:115:26)

Node.js v18.16.1

Can someone try to recreate this?

  1. Node.js v18.16.1
    1.1 mongoose-to-swagger ^1.4.0
    1.2 mongoose ^6.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant