4 ms·
Show HN: My first open-source project release – RandomJson
- tlarkworthy 7y agoSee also https://www.json-generator.com https://www.json-generator.com for random data from a JSON schema
- lichtenberger 7y agoGreat, I'll use it for testing :-)
- ivanche 7y agoCongratulations, I hope you'll release many more projects! A small suggestion: show examples of generated JSON alongside the source code.
- 2T1Qka0rEiPr 7y agoAgree completely. When it comes to OSS I'd say: documentation, documentation, documentation. Specifically in your case, a detailed explanation of the API would also be really handy :)
- mangatmodi 7y agoI agree with you both. Developers hate documentation but I would add plethora of documentations and examples in next few days.
- ben509 7y agoCongrats on the release! I'd recommend mentioning "fuzz testing" and "fuzzing" in the description to help people find it. Simple and Sample are very close in spelling. The sample makes sense, but a big use case for this would be testing APIs, and in that case, a JSON object is commonly modelled after the attributes of a class. So in that scenario, simply randomizing the keys would just blow up, which is not useful for testing. The kinds of errors you usually want to catch are small glitches. I needed to describe the patterns that JSON could take when converting to and from native types, and I did that here [1] so it might be a useful structure to consider. But, roughly, you have several common cases: 1. atoms 2. homogenous arrays (same type of all elements) 3. heterogeneous arrays (element X has type Y, bounded length) 4. homogenous objects (same value type for all elements) 5. heterogeneous objects (key X has type Y, required + optional keys) 6. alternatives Implement those and you probably cover any structure someone could throw at it. You'll also want to make it easy to distinguish between required and optional keys. If you take a page from QuickCheck[2], it's nice to be able to implement a "reduce" feature. The idea is you produce something complex that breaks it, and simplify it to find a minimal test case. You might go both ways... generate a valid pattern and add crap to it to see how tolerant it is. Or possibly start with reasonable length strings and make it possible to make them longer and longer. [1]: https://github.com/UnitedIncome/json-syntax/blob/master/json_syntax/pattern.py https://github.com/UnitedIncome/json-syntax/blob/master/json... [2]: https://hackage.haskell.org/package/QuickCheck https://hackage.haskell.org/package/QuickCheck Versions of QuickCheck exist in many languages, e.g. https://github.com/HypothesisWorks/hypothesis-java https://github.com/HypothesisWorks/hypothesis-java
- mangatmodi 7y ago@ben509 thanks for amazing suggestions. I plan to add multiple features in next few days.
- sbwmk 7y agoJava? What is this, 1995?
- skdotdan 7y agoActually, it's Kotlin.
- jedimastert 7y agoMods: Can you remove the anchor from the link?
- mangatmodi 7y agoMy bad, I should have been careful when I submitted the post
- michaelmior 7y agoLooks interesting. It would be helpful if you could show more examples of the JSON this produces. I can guess from the code, but it would be nice if this were explicit.
- bmaupin 7y agoNice work! I'd recommend adding a license to make it easier for other people to contribute (if that's something you'd like): https://help.github.com/en/articles/licensing-a-repository https://help.github.com/en/articles/licensing-a-repository
- mangatmodi 7y agoThanks, I have added MIT license now.
- hendry 7y agoI've been using https://github.com/yields/phony https://github.com/yields/phony lately for my random JSON needs.