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

Callstack Exceeded #46

Open
leafoflegend opened this issue Nov 6, 2017 · 1 comment
Open

Callstack Exceeded #46

leafoflegend opened this issue Nov 6, 2017 · 1 comment

Comments

@leafoflegend
Copy link

RangeError: Maximum call stack size exceeded
    at defaultParsingFlags (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:97:5)
    at getParsingFlags (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:117:17)
    at isValid (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:142:21)
    at prepareConfig (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:2575:10)
    at createFromConfig (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:2539:40)
    at createLocalOrUTC (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:2626:12)
    at createLocal (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:2630:12)
    at hooks (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/node_modules/moment/moment.js:16:25)
    at dataTime (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/lib/generators/format.js:7:24)
    at stringMock (/Users/eliotszwajkowski/Projects/wm-payments/node_modules/swagmock/lib/generators/index.js:185:41)

This is when I do my first mockgen.response. Any ideas here?

@leafoflegend
Copy link
Author

This had to do with circular references.

let mockgen = null;

SwaggerParser
	.dereference(latestSpecs, { dereference: { circular: 'ignore' } })
	.then((specs) => {
		deRefedSpecs = specs;
		mockgen = swagmock(deRefedSpecs, { validated: true });
	})
	.catch((e) => {
		console.log(chalk.red('Dereferencing swagger resulted in error.'));
		console.log(chalk.red(e));
	});

I used the above code to deal with this - but sadly, any of the routes with circular references do not get the advantages of swagmock. Is there any way around this? To generate mock responses for routes that have circular refs?

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