Comments (3)
The problem arises somewhere inside of this:
return random(Math.random() > 0.5, min, max);
as I look down into random.js file I think it's totally overcomplicated. I mean, if I want to generate a random number, why shouldn't I just use pure, simple functions instead of complicated logic combined with faker.random.number?
from json-schema-faker.
m'kay, I'm on my way to fix the bug. It's integer.js. When it's generating {min:5,max:10}
then the floor
function is perfectly fine. But when it's generating {min:-10,max:-5}
, then the floor
function might go beyond the scope, e.g. -10.23564568623 and then the floor will make it -11
(beyond scope). Probably need to make it ceil
if negative.
Need more tests to solve low level functions :( (non-jsf tests)
from json-schema-faker.
Done, fixed. Currenty in the develop
branch.
From this build the problem should be gone. It was happening once per ~10 shots, but anyway, was returning wrong results (and failing tests unexpectedly and nondeterministically).
from json-schema-faker.
Related Issues (20)
- incorrect generated type with relatively simple `allOf`/`oneOf`
- Issue with Entering JSON Schema on json-schema-faker.js.org HOT 1
- Regression from v0.4.7: Incorrect generated value for schema with `type` and `not.enum`.
- why you do. not good examples for react ?
- Wrapping anyOf in allOf produces invalid output HOT 2
- ts(1479) when importing in a commonjs project with NodeNext HOT 5
- Error: TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at merge HOT 5
- Browser.process evaluated as true in `vendor.js` when run in a Node environment HOT 2
- References to primitive values are resolved as objects HOT 7
- Bug - Property named dependencies is not getting generated property HOT 6
- Bug - Integer property with pattern becomes a string property
- Nested reuse of definition sometimes leads to false Json HOT 3
- Extension with non-identifier property name doesn't work
- Infinite loop when using patternProperties that have less than 5 possibilities
- Issues on generation: array with `minItems` not being respected
- Empty objects are being generated for string data types HOT 1
- Floating point rounding when using multipleOf
- Bug: json-schema-faker generate not including additionalItems for array
- Exclusive fields specified by not{} against required should have individuals added
- `generateYAML` fails due to bug in build system
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-schema-faker.