Skip to content

Conversation

@ePaul
Copy link
Contributor

@ePaul ePaul commented Mar 14, 2017

PR checklist

  • Read the contribution guidelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change.
    → bin/nodejs-petstore-google-cloud-functions.sh && bin/nodejs-petstore-server.sh (twice: before and after the update.)
  • Filed the PR against the correct branch: master for non-breaking changes.

Description of the PR

This changes the randomness introduced into ExampleGenerator in #4797 to be deterministic.
This way, in each run of the generator the same output is produced when using the same input.

Previously, you got random changes each time you updated the NodeJS sample, which made it tedious to find out what actually changed. See ccc117c for an example commit containing just those changes. When merging different branches, this leads to unnecessary conflicts.

With this PR the randomness generator is totally deterministic, generating the sequence 0,6,1 for all integer values without min/max. I guess we could use the input for the example generator as a seed to the Random object, to have the result a bit more random-looking? Opinions?

(The last commit of this PR applies this on the nodejs samples, the first commit updates the samples with the old code.)

/cc @bartkummel @wing328

Paŭlo Ebermann added 3 commits March 14, 2017 22:19
This avoids changing results after each generation, and makes diff reviews easier.
This is the last "randomness" update. From now on the samples should only change if either the generator, the input or parameters change.
@bartkummel
Copy link
Contributor

Nive improvement, @ePaul !

@wing328 wing328 added this to the v2.2.3 milestone Mar 15, 2017
@wing328 wing328 merged commit 31f29be into swagger-api:master Mar 15, 2017
@wing328
Copy link
Contributor

wing328 commented Mar 15, 2017

@ePaul thanks for the enhancement.

@bartkummel thanks for reviewing the change.

@ePaul ePaul deleted the use-deterministic-randomness-4797 branch March 16, 2017 20:47
spr3nk3ls pushed a commit to spr3nk3ls/swagger-codegen that referenced this pull request Mar 28, 2017
* Update samples for nodejs + nodejs-google-cloud-functions.

* Fix example generator to use deterministic randomness.

This avoids changing results after each generation, and makes diff reviews easier.

* Update NodeJS samples.

This is the last "randomness" update. From now on the samples should only change if either the generator, the input or parameters change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants