Repository: json-schema-faker/json-schema-faker (js)

Issue:
Maximum is not inclusive
Hey guys, I've found a bug in [this line](https://github.com/json-schema-faker/json-schema-faker/blob/develop/src/lib/types/number.mjs#LL50C58-L50C58) of code. The problem is the fifth parameter (hasPrecision) which 
makes it impossible to generante a random integer from 0 to 1 from the following schema:

```
{
  "type": "integer",
  "minimum": 0,
  "maximum": 1
}
```

From the docs, if I don't provide a boolean true for `exclusiveMaximum`, it should be able to generate a integer 0 or 1. With that in mind, the line I provided will always make the flag hasPrecision to be true, and will end up entering [this conditional](https://github.com/json-schema-faker/json-schema-faker/blob/develop/src/lib/core/random.mjs#L91), which will call [getRandom](https://github.com/json-schema-faker/json-schema-faker/blob/develop/src/lib/core/random.mjs#L66) instead of [getRandomInteger](https://github.com/json-schema-faker/json-schema-faker/blob/develop/src/lib/core/random.mjs#L6), causing it to always return a 0.

To make matters worse, the schema bellow will always return 0 too! This happens because the `exclusiveMaximum` substracts 1 from the maximum, making it have the same results from above.

```
{
  "type": "integer",
  "minimum": 0,
  "maximum": 2,
  "exclusiveMaximum": true
}
```


Pull request description:
fix: set hasPrecision to false when type is integer, closes #743
This is a quick solution for the issue I addressed in #743. Instead of making the flag hasPrecision always true for numbers, we can set it to false to fix the problem.

Patch:
diff --git a/src/lib/types/number.mjs b/src/lib/types/number.mjs
index 3b0b9d6..4ee101e 100644
--- a/src/lib/types/number.mjs
+++ b/src/lib/types/number.mjs
@@ -47,7 +47,7 @@ function numberType(value) {
     return base;
   }
 
-  return random.number(min, max, undefined, undefined, true);
+  return random.number(min, max, undefined, undefined, value.type !== 'integer');
 }
 
 export default numberType;


Test patch:
diff --git a/tests/schema/core/option/random.json b/tests/schema/core/option/random.json
index 9cbe6dc..6f23277 100644
--- a/tests/schema/core/option/random.json
+++ b/tests/schema/core/option/random.json
@@ -23,7 +23,7 @@
         },
         "valid": true,
         "equal": {
-          "a": 43,
+          "a": 44,
           "b": "in culpa proident amet",
           "c": "fe228"
         },
diff --git a/tests/unit/generators/number.spec.mjs b/tests/unit/generators/number.spec.mjs
index 96f06b0..aec4034 100644
--- a/tests/unit/generators/number.spec.mjs
+++ b/tests/unit/generators/number.spec.mjs
@@ -27,6 +27,11 @@ describe('Number Generator', () => {
     expect(isMultipleOf({ multipleOf: 8, minimum: 80, maximum: 90 })).to.be.true;
   });
 
+  it('should return an integer', () => {
+    const n = numberType({ type: 'integer' });
+    expect(Number.isInteger(n)).to.be.true;
+  });
+
   describe('should ignore min and max if using Number.MAX_VALUE in then', () => {
     it('ignoring minimum', () => {
       const n = numberType({ minimum: -Number.MAX_VALUE });