@jinshuju/cli 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/commands/checkin.js +15 -2
- package/dist/commands/field.js +1 -1
- package/dist/commands/form.js +335 -13
- package/dist/commands/index.js +1 -6
- package/dist/commands/routine.js +3 -1
- package/dist/commands/shared.d.ts +19 -2
- package/dist/commands/shared.js +105 -2
- package/dist/commands/table.js +13 -1
- package/dist/commands/upload.d.ts +3 -3
- package/dist/commands/upload.js +4 -3
- package/dist/generated/operations.d.ts +1 -1
- package/dist/generated/operations.js +768 -168
- package/dist/schema.js +12 -0
- package/dist/spec.d.ts +3 -0
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -32,6 +32,12 @@ export function validate(schema, value, pointer = '', certain = true) {
|
|
|
32
32
|
if (s.exclusiveMaximum !== undefined && value >= s.exclusiveMaximum) {
|
|
33
33
|
issue('range', `must be less than ${s.exclusiveMaximum}`);
|
|
34
34
|
}
|
|
35
|
+
// A decimal step such as 0.01 never divides a float exactly, so a quotient a rounding error off whole is whole.
|
|
36
|
+
if (s.multipleOf !== undefined) {
|
|
37
|
+
const steps = value / s.multipleOf;
|
|
38
|
+
if (Math.abs(steps - Math.round(steps)) > 1e-9)
|
|
39
|
+
issue('range', `must be a multiple of ${s.multipleOf}`);
|
|
40
|
+
}
|
|
35
41
|
}
|
|
36
42
|
if (typeof value === 'string') {
|
|
37
43
|
const length = [...value].length;
|
|
@@ -91,6 +97,12 @@ function objectIssues(s, value, pointer, certain) {
|
|
|
91
97
|
for (const name of s.required ?? [])
|
|
92
98
|
if (!(name in value))
|
|
93
99
|
missing(name, 'is required');
|
|
100
|
+
const keys = Object.keys(value).length;
|
|
101
|
+
const range = (message) => issues.push({ pointer, kind: 'range', message, value, certain });
|
|
102
|
+
if (s.minProperties !== undefined && keys < s.minProperties)
|
|
103
|
+
range(`must have at least ${s.minProperties} ${s.minProperties === 1 ? 'key' : 'keys'}`);
|
|
104
|
+
if (s.maxProperties !== undefined && keys > s.maxProperties)
|
|
105
|
+
range(`must have at most ${s.maxProperties} ${s.maxProperties === 1 ? 'key' : 'keys'}`);
|
|
94
106
|
for (const [name, needs] of Object.entries(s.dependentRequired ?? {})) {
|
|
95
107
|
if (!(name in value))
|
|
96
108
|
continue;
|
package/dist/spec.d.ts
CHANGED
|
@@ -40,10 +40,13 @@ export interface Schema {
|
|
|
40
40
|
readonly maximum?: number;
|
|
41
41
|
readonly exclusiveMinimum?: number;
|
|
42
42
|
readonly exclusiveMaximum?: number;
|
|
43
|
+
readonly multipleOf?: number;
|
|
43
44
|
readonly minLength?: number;
|
|
44
45
|
readonly maxLength?: number;
|
|
45
46
|
readonly minItems?: number;
|
|
46
47
|
readonly maxItems?: number;
|
|
48
|
+
readonly minProperties?: number;
|
|
49
|
+
readonly maxProperties?: number;
|
|
47
50
|
readonly uniqueItems?: boolean;
|
|
48
51
|
readonly pattern?: string;
|
|
49
52
|
/**
|