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

Deterministic output #772

Open
hectorj-thetreep opened this issue Oct 5, 2023 · 1 comment
Open

Deterministic output #772

hectorj-thetreep opened this issue Oct 5, 2023 · 1 comment

Comments

@hectorj-thetreep
Copy link

Hi and thank you for your work.

Would it be possible for the generated ids and lorem ipsum to be deterministic?

Right now, running the generation twice with the exact same input produces a small diff in ids and example data.

Maybe the ability to provide a rand seed in options?

@alexeyr-ci
Copy link

alexeyr-ci commented Jul 19, 2024

I noticed in https://github.com/postmanlabs/openapi-to-postman/blob/adebab9d5acc921fb3af82a29e89fb9aa4ae7d49/assets/json-schema-faker.js use of optionAPI('random')() (though it's mixed with Math.random()). random is not documented in https://github.com/postmanlabs/openapi-to-postman/blob/adebab9d5acc921fb3af82a29e89fb9aa4ae7d49/OPTIONS.md.

However, even if in my code I do

const fakeTimers = require('@sinonjs/fake-timers');
fakeTimers.install({ now: new Date('2024-01-01T00:00:00Z') });

const random = () => 0;
Math.random = random;
const converter = require('openapi-to-postmanv2');
...
converter.convert({ type: 'json', data: swaggerJSON }, { random: random }, callback);

I still see random item and response ids and couldn't find where those come from (but fixed in the callback).

@hectorj-thetreep hectorj-thetreep changed the title deterministic output Deterministic output Jul 19, 2024
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

2 participants