Use deterministic randomness in ExampleGenerator.#5068
Merged
wing328 merged 3 commits intoswagger-api:masterfrom Mar 15, 2017
Merged
Use deterministic randomness in ExampleGenerator.#5068wing328 merged 3 commits intoswagger-api:masterfrom
wing328 merged 3 commits intoswagger-api:masterfrom
Conversation
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.
Contributor
|
Nive improvement, @ePaul ! |
Contributor
|
@ePaul thanks for the enhancement. @bartkummel thanks for reviewing the change. |
This was referenced Mar 19, 2017
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
./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.)
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