Skip to content

Commit 7c346e7

Browse files
authored
fix(json-schema-2020-12-samples): use zero as default example value for int32 and int64 (#10230)
1 parent d9c778e commit 7c346e7

File tree

3 files changed

+4
-8
lines changed
  • src/core/plugins/json-schema-2020-12-samples/fn/generators
  • test/unit/core/plugins/json-schema-2020-12-samples

3 files changed

+4
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @prettier
33
*/
4-
const int32Generator = () => (2 ** 30) >>> 0
4+
const int32Generator = () => 0
55

66
export default int32Generator
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @prettier
33
*/
4-
const int64Generator = () => 2 ** 53 - 1
4+
const int64Generator = () => 0
55

66
export default int64Generator

test/unit/core/plugins/json-schema-2020-12-samples/fn.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,8 @@ describe("sampleFromSchema", () => {
7979
expect(sample({ type: "number", format: "float" })).toStrictEqual(0.1)
8080
expect(sample({ type: "number", format: "double" })).toStrictEqual(0.1)
8181
expect(sample({ type: "integer" })).toStrictEqual(0)
82-
expect(sample({ type: "integer", format: "int32" })).toStrictEqual(
83-
(2 ** 30) >>> 0
84-
)
85-
expect(sample({ type: "integer", format: "int64" })).toStrictEqual(
86-
2 ** 53 - 1
87-
)
82+
expect(sample({ type: "integer", format: "int32" })).toStrictEqual(0)
83+
expect(sample({ type: "integer", format: "int64" })).toStrictEqual(0)
8884
expect(sample({ type: "boolean" })).toStrictEqual(true)
8985
expect(sample({ type: "null" })).toStrictEqual(null)
9086
})

0 commit comments

Comments
 (0)