zapier-platform-schema 15.19.0 → 16.0.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/exported-schema.json +1 -1
- package/lib/functional-constraints/bufferedCreateConstraints.js +11 -11
- package/lib/functional-constraints/deepNestedFields.js +7 -7
- package/lib/functional-constraints/labelWhenVisible.js +2 -2
- package/lib/functional-constraints/matchingKeys.js +2 -2
- package/lib/functional-constraints/mutuallyExclusiveFields.js +3 -3
- package/lib/functional-constraints/pollingThrottle.js +2 -2
- package/lib/functional-constraints/requirePerformConditionally.js +2 -2
- package/lib/functional-constraints/requiredSamples.js +3 -3
- package/lib/functional-constraints/searchOrCreateKeys.js +29 -29
- package/lib/functional-constraints/uniqueInputFieldKeys.js +6 -7
- package/lib/schemas/AppSchema.js +2 -3
- package/lib/schemas/AuthenticationCustomConfigSchema.js +1 -1
- package/lib/schemas/AuthenticationOAuth1ConfigSchema.js +1 -1
- package/lib/schemas/AuthenticationOAuth2ConfigSchema.js +1 -1
- package/lib/schemas/AuthenticationSchema.js +1 -1
- package/lib/schemas/AuthenticationSessionConfigSchema.js +1 -1
- package/lib/schemas/BasicActionOperationSchema.js +2 -2
- package/lib/schemas/BasicCreateActionOperationSchema.js +2 -2
- package/lib/schemas/BasicHookOperationSchema.js +2 -2
- package/lib/schemas/BasicHookToPollOperationSchema.js +2 -2
- package/lib/schemas/BasicOperationSchema.js +9 -1
- package/lib/schemas/BasicPollingOperationSchema.js +2 -2
- package/lib/schemas/BulkReadSchema.js +1 -1
- package/lib/schemas/BulkReadsSchema.js +1 -1
- package/lib/schemas/CreateSchema.js +1 -1
- package/lib/schemas/CreatesSchema.js +1 -1
- package/lib/schemas/DynamicFieldsSchema.js +1 -1
- package/lib/schemas/FieldChoiceWithLabelSchema.js +1 -1
- package/lib/schemas/FieldChoicesSchema.js +1 -1
- package/lib/schemas/FieldOrFunctionSchema.js +1 -1
- package/lib/schemas/FieldSchema.js +1 -1
- package/lib/schemas/FieldsSchema.js +1 -1
- package/lib/schemas/FunctionSchema.js +1 -1
- package/lib/schemas/HydratorsSchema.js +1 -1
- package/lib/schemas/MiddlewaresSchema.js +1 -1
- package/lib/schemas/RedirectRequestSchema.js +1 -1
- package/lib/schemas/RequestSchema.js +1 -1
- package/lib/schemas/ResourceMethodCreateSchema.js +1 -1
- package/lib/schemas/ResourceMethodGetSchema.js +1 -1
- package/lib/schemas/ResourceMethodHookSchema.js +1 -1
- package/lib/schemas/ResourceMethodListSchema.js +1 -1
- package/lib/schemas/ResourceMethodSearchSchema.js +1 -1
- package/lib/schemas/ResourceSchema.js +1 -1
- package/lib/schemas/ResourcesMethodGetSchema.js +1 -1
- package/lib/schemas/ResourcesSchema.js +1 -1
- package/lib/schemas/SearchAndCreatesSchema.js +1 -1
- package/lib/schemas/SearchOrCreateSchema.js +1 -1
- package/lib/schemas/SearchOrCreatesSchema.js +1 -1
- package/lib/schemas/SearchSchema.js +1 -1
- package/lib/schemas/SearchesSchema.js +1 -1
- package/lib/schemas/ThrottleObjectSchema.js +1 -1
- package/lib/schemas/TriggerSchema.js +1 -1
- package/lib/schemas/TriggersSchema.js +1 -1
- package/lib/utils/buildDocs.js +2 -2
- package/lib/utils/exportSchema.js +1 -1
- package/lib/utils/makeValidator.js +5 -5
- package/package.json +1 -1
package/exported-schema.json
CHANGED
|
@@ -18,8 +18,8 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
18
18
|
'/BasicCreateActionOperationSchema',
|
|
19
19
|
`instance.${actionType}.${actionDef.key}.operation`,
|
|
20
20
|
'missing',
|
|
21
|
-
'performBuffer'
|
|
22
|
-
)
|
|
21
|
+
'performBuffer',
|
|
22
|
+
),
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -31,8 +31,8 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
31
31
|
'/BasicCreateActionOperationSchema',
|
|
32
32
|
`instance.${actionType}.${actionDef.key}.operation`,
|
|
33
33
|
'invalid',
|
|
34
|
-
'perform'
|
|
35
|
-
)
|
|
34
|
+
'perform',
|
|
35
|
+
),
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
41
41
|
const inputFields = _.get(
|
|
42
42
|
actionDef,
|
|
43
43
|
['operation', 'inputFields'],
|
|
44
|
-
[]
|
|
44
|
+
[],
|
|
45
45
|
);
|
|
46
46
|
inputFields.forEach((inputField) => {
|
|
47
47
|
if (inputField.required) {
|
|
@@ -58,8 +58,8 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
58
58
|
'/BufferConfigSchema',
|
|
59
59
|
`instance.${actionType}.${actionDef.key}.operation.buffer.groupedBy[${index}]`,
|
|
60
60
|
'invalid',
|
|
61
|
-
'groupedBy'
|
|
62
|
-
)
|
|
61
|
+
'groupedBy',
|
|
62
|
+
),
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -75,8 +75,8 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
75
75
|
'/BasicCreateActionOperationSchema',
|
|
76
76
|
`instance.${actionType}.${actionDef.key}.operation`,
|
|
77
77
|
'missing',
|
|
78
|
-
'buffer'
|
|
79
|
-
)
|
|
78
|
+
'buffer',
|
|
79
|
+
),
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -88,8 +88,8 @@ const bufferedCreateConstraints = (definition) => {
|
|
|
88
88
|
'/BasicCreateActionOperationSchema',
|
|
89
89
|
`instance.${actionType}.${actionDef.key}.operation`,
|
|
90
90
|
'invalid',
|
|
91
|
-
'perform'
|
|
92
|
-
)
|
|
91
|
+
'perform',
|
|
92
|
+
),
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -16,13 +16,13 @@ const collectErrors = (inputFields, path) => {
|
|
|
16
16
|
'/FieldSchema',
|
|
17
17
|
`instance.${path}.inputFields[${index}].children`,
|
|
18
18
|
'empty',
|
|
19
|
-
'inputFields'
|
|
20
|
-
)
|
|
19
|
+
'inputFields',
|
|
20
|
+
),
|
|
21
21
|
);
|
|
22
22
|
} else {
|
|
23
23
|
const hasDeeplyNestedChildren = _.some(
|
|
24
24
|
inputField.children,
|
|
25
|
-
(child) => child.children
|
|
25
|
+
(child) => child.children,
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
if (hasDeeplyNestedChildren) {
|
|
@@ -33,8 +33,8 @@ const collectErrors = (inputFields, path) => {
|
|
|
33
33
|
'/FieldSchema',
|
|
34
34
|
`instance.${path}.inputFields[${index}]`,
|
|
35
35
|
'deepNesting',
|
|
36
|
-
'inputFields'
|
|
37
|
-
)
|
|
36
|
+
'inputFields',
|
|
37
|
+
),
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -54,8 +54,8 @@ const validateFieldNesting = (definition) => {
|
|
|
54
54
|
errors = errors.concat(
|
|
55
55
|
collectErrors(
|
|
56
56
|
actionDef.operation.inputFields,
|
|
57
|
-
`${typeOf}.${actionDef.key}
|
|
58
|
-
)
|
|
57
|
+
`${typeOf}.${actionDef.key}`,
|
|
58
|
+
),
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -35,8 +35,8 @@ const verifyIncompatibilities = (inputFields, path) => {
|
|
|
35
35
|
'/FieldSchema',
|
|
36
36
|
`instance.${path}.inputFields[${index}]`,
|
|
37
37
|
'invalid',
|
|
38
|
-
'inputFields'
|
|
39
|
-
)
|
|
38
|
+
'inputFields',
|
|
39
|
+
),
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -56,7 +56,7 @@ const mutuallyExclusiveFields = (definition) => {
|
|
|
56
56
|
...errors,
|
|
57
57
|
...verifyIncompatibilities(
|
|
58
58
|
actionDef.operation.inputFields,
|
|
59
|
-
`${typeOf}.${actionDef.key}
|
|
59
|
+
`${typeOf}.${actionDef.key}`,
|
|
60
60
|
),
|
|
61
61
|
];
|
|
62
62
|
}
|
|
@@ -18,7 +18,7 @@ const check = (definition) => {
|
|
|
18
18
|
: new jsonschema.ValidationError(
|
|
19
19
|
'requires "sample", because it\'s not hidden',
|
|
20
20
|
definition,
|
|
21
|
-
definition.id
|
|
21
|
+
definition.id,
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ module.exports = (definition, mainSchema) => {
|
|
|
27
27
|
|
|
28
28
|
if (mainSchema.id === RESOURCE_ID) {
|
|
29
29
|
definitions = RESOURCE_METHODS.map((method) => definition[method]).filter(
|
|
30
|
-
Boolean
|
|
30
|
+
Boolean,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
// allow method definitions to inherit the sample
|
|
@@ -44,7 +44,7 @@ module.exports = (definition, mainSchema) => {
|
|
|
44
44
|
new jsonschema.ValidationError(
|
|
45
45
|
'expected at least one resource operation',
|
|
46
46
|
definition,
|
|
47
|
-
definition.id
|
|
47
|
+
definition.id,
|
|
48
48
|
),
|
|
49
49
|
];
|
|
50
50
|
}
|
|
@@ -15,7 +15,7 @@ const getSearchOutputSampleKeys = (definition, searchKey) => {
|
|
|
15
15
|
const searchOutputSampleFields = _.get(
|
|
16
16
|
definition.searches,
|
|
17
17
|
`${searchKey}.operation.sample`,
|
|
18
|
-
{}
|
|
18
|
+
{},
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
return Object.keys(searchOutputSampleFields);
|
|
@@ -41,19 +41,19 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
41
41
|
|
|
42
42
|
const updateInputKeys = getFieldKeys(
|
|
43
43
|
definition.creates,
|
|
44
|
-
`${updateKey}.operation.inputFields
|
|
44
|
+
`${updateKey}.operation.inputFields`,
|
|
45
45
|
);
|
|
46
46
|
const searchInputKeys = getFieldKeys(
|
|
47
47
|
definition.searches,
|
|
48
|
-
`${searchKey}.operation.inputFields
|
|
48
|
+
`${searchKey}.operation.inputFields`,
|
|
49
49
|
);
|
|
50
50
|
const searchOutputKeys = getFieldKeys(
|
|
51
51
|
definition.searches,
|
|
52
|
-
`${searchKey}.operation.outputFields
|
|
52
|
+
`${searchKey}.operation.outputFields`,
|
|
53
53
|
);
|
|
54
54
|
const searchOutputSampleKeys = getSearchOutputSampleKeys(
|
|
55
55
|
definition,
|
|
56
|
-
searchKey
|
|
56
|
+
searchKey,
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
// There are constraints where we check for keys in either outputFields or sample, so combining them is a shortcut
|
|
@@ -65,11 +65,11 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
65
65
|
// For some constraints, there is a difference between not "having" a key defined versus having one but with empty values
|
|
66
66
|
const hasSearchOutputFields = _.has(
|
|
67
67
|
definition.searches,
|
|
68
|
-
`${searchKey}.operation.outputFields
|
|
68
|
+
`${searchKey}.operation.outputFields`,
|
|
69
69
|
);
|
|
70
70
|
const hasSearchOutputSample = _.has(
|
|
71
71
|
definition.searches,
|
|
72
|
-
`${searchKey}.operation.sample
|
|
72
|
+
`${searchKey}.operation.sample`,
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
// Confirm searchOrCreate.key matches a searches.key (current Zapier editor limitation)
|
|
@@ -81,8 +81,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
81
81
|
'/SearchOrCreateSchema',
|
|
82
82
|
`instance.${searchCreatesKey}.${key}.key`,
|
|
83
83
|
'invalidKey',
|
|
84
|
-
'key'
|
|
85
|
-
)
|
|
84
|
+
'key',
|
|
85
|
+
),
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -95,8 +95,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
95
95
|
'/SearchOrCreateSchema',
|
|
96
96
|
`instance.${searchCreatesKey}.${key}.search`,
|
|
97
97
|
'invalidKey',
|
|
98
|
-
'search'
|
|
99
|
-
)
|
|
98
|
+
'search',
|
|
99
|
+
),
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -109,8 +109,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
109
109
|
'/SearchOrCreateSchema',
|
|
110
110
|
`instance.${searchCreatesKey}.${key}.create`,
|
|
111
111
|
'invalidKey',
|
|
112
|
-
'create'
|
|
113
|
-
)
|
|
112
|
+
'create',
|
|
113
|
+
),
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -122,8 +122,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
122
122
|
searchOrCreateDef,
|
|
123
123
|
'/SearchOrCreateSchema',
|
|
124
124
|
`instance.${searchCreatesKey}.${key}.update`,
|
|
125
|
-
'invalidKey'
|
|
126
|
-
)
|
|
125
|
+
'invalidKey',
|
|
126
|
+
),
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -135,8 +135,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
135
135
|
searchOrCreateDef,
|
|
136
136
|
'/SearchOrCreateSchema',
|
|
137
137
|
`instance.${searchCreatesKey}.${key}.updateInputFromSearchOutput`,
|
|
138
|
-
'invalid'
|
|
139
|
-
)
|
|
138
|
+
'invalid',
|
|
139
|
+
),
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -148,8 +148,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
148
148
|
searchOrCreateDef,
|
|
149
149
|
'/SearchOrCreateSchema',
|
|
150
150
|
`instance.${searchCreatesKey}.${key}.searchUniqueInputToOutputConstraint`,
|
|
151
|
-
'invalid'
|
|
152
|
-
)
|
|
151
|
+
'invalid',
|
|
152
|
+
),
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -167,7 +167,7 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
167
167
|
const searchOutputOptionHint = `(options: ${[...allSearchOutputKeys]})`;
|
|
168
168
|
|
|
169
169
|
for (const [updateInputField, searchOutputField] of Object.entries(
|
|
170
|
-
searchOrCreateDef.updateInputFromSearchOutput
|
|
170
|
+
searchOrCreateDef.updateInputFromSearchOutput,
|
|
171
171
|
)) {
|
|
172
172
|
if (!updateInputKeys.includes(updateInputField)) {
|
|
173
173
|
errors.push(
|
|
@@ -176,8 +176,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
176
176
|
searchOrCreateDef,
|
|
177
177
|
'/SearchOrCreateSchema',
|
|
178
178
|
`instance.${searchCreatesKey}.${key}.updateInputFromSearchOutput`,
|
|
179
|
-
'invalidKey'
|
|
180
|
-
)
|
|
179
|
+
'invalidKey',
|
|
180
|
+
),
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -191,8 +191,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
191
191
|
searchOrCreateDef,
|
|
192
192
|
'/SearchOrCreateSchema',
|
|
193
193
|
`instance.${searchCreatesKey}.${key}.updateInputFromSearchOutput`,
|
|
194
|
-
'invalidKey'
|
|
195
|
-
)
|
|
194
|
+
'invalidKey',
|
|
195
|
+
),
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -212,7 +212,7 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
212
212
|
const searchOutputOptionHint = `(options: ${[...allSearchOutputKeys]})`;
|
|
213
213
|
|
|
214
214
|
for (const [searchInputField, searchOutputField] of Object.entries(
|
|
215
|
-
searchOrCreateDef.searchUniqueInputToOutputConstraint
|
|
215
|
+
searchOrCreateDef.searchUniqueInputToOutputConstraint,
|
|
216
216
|
)) {
|
|
217
217
|
if (!searchInputKeys.includes(searchInputField)) {
|
|
218
218
|
errors.push(
|
|
@@ -221,8 +221,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
221
221
|
searchOrCreateDef,
|
|
222
222
|
'/SearchOrCreateSchema',
|
|
223
223
|
`instance.${searchCreatesKey}.${key}.searchUniqueInputToOutputConstraint`,
|
|
224
|
-
'invalidKey'
|
|
225
|
-
)
|
|
224
|
+
'invalidKey',
|
|
225
|
+
),
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -237,8 +237,8 @@ const validateSearchCreateKeys = (definition, searchCreatesKey) => {
|
|
|
237
237
|
searchOrCreateDef,
|
|
238
238
|
'/SearchOrCreateSchema',
|
|
239
239
|
`instance.${searchCreatesKey}.${key}.searchUniqueInputToOutputConstraint`,
|
|
240
|
-
'invalidKey'
|
|
241
|
-
)
|
|
240
|
+
'invalidKey',
|
|
241
|
+
),
|
|
242
242
|
);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
@@ -30,8 +30,8 @@ const uniqueInputFieldKeys = (definition) => {
|
|
|
30
30
|
}.key`,
|
|
31
31
|
inputField.key,
|
|
32
32
|
`/BasicOperationSchema`,
|
|
33
|
-
`instance.${actionType}.${key}.operation.inputFields[${index}].key
|
|
34
|
-
)
|
|
33
|
+
`instance.${actionType}.${key}.operation.inputFields[${index}].key`,
|
|
34
|
+
),
|
|
35
35
|
);
|
|
36
36
|
} else {
|
|
37
37
|
existingKeys[inputField.key] = `inputFields[${index}]`;
|
|
@@ -48,13 +48,12 @@ const uniqueInputFieldKeys = (definition) => {
|
|
|
48
48
|
}.key`,
|
|
49
49
|
subField.key,
|
|
50
50
|
`/BasicOperationSchema`,
|
|
51
|
-
`instance.${actionType}.${key}.operation.inputFields[${index}].children[${subFieldIndex}].key
|
|
52
|
-
)
|
|
51
|
+
`instance.${actionType}.${key}.operation.inputFields[${index}].children[${subFieldIndex}].key`,
|
|
52
|
+
),
|
|
53
53
|
);
|
|
54
54
|
} else {
|
|
55
|
-
existingKeys[
|
|
56
|
-
|
|
57
|
-
] = `inputFields[${index}].children[${subFieldIndex}]`;
|
|
55
|
+
existingKeys[subField.key] =
|
|
56
|
+
`inputFields[${index}].children[${subFieldIndex}]`;
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
59
|
});
|
package/lib/schemas/AppSchema.js
CHANGED
|
@@ -107,8 +107,7 @@ module.exports = makeSchema(
|
|
|
107
107
|
$ref: AppFlagsSchema.id,
|
|
108
108
|
},
|
|
109
109
|
throttle: {
|
|
110
|
-
description:
|
|
111
|
-
`Zapier uses this configuration to apply throttling when the limit for the window is exceeded. When set here, it is the default throttle configuration used on each action of the integration. And when set in an action's operation object, it gets overwritten for that action only.`,
|
|
110
|
+
description: `Zapier uses this configuration to apply throttling when the limit for the window is exceeded. When set here, it is the default throttle configuration used on each action of the integration. And when set in an action's operation object, it gets overwritten for that action only.`,
|
|
112
111
|
$ref: ThrottleObjectSchema.id,
|
|
113
112
|
},
|
|
114
113
|
legacy: {
|
|
@@ -157,5 +156,5 @@ module.exports = makeSchema(
|
|
|
157
156
|
HydratorsSchema,
|
|
158
157
|
AppFlagsSchema,
|
|
159
158
|
ThrottleObjectSchema,
|
|
160
|
-
]
|
|
159
|
+
],
|
|
161
160
|
);
|
|
@@ -10,7 +10,7 @@ const RequestSchema = require('./RequestSchema');
|
|
|
10
10
|
// TODO: would be nice to deep merge these instead
|
|
11
11
|
// or maybe use allOf which is built into json-schema
|
|
12
12
|
const BasicActionOperationSchema = JSON.parse(
|
|
13
|
-
JSON.stringify(BasicOperationSchema.schema)
|
|
13
|
+
JSON.stringify(BasicOperationSchema.schema),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
BasicActionOperationSchema.id = '/BasicActionOperationSchema';
|
|
@@ -57,5 +57,5 @@ BasicActionOperationSchema.antiExamples = [
|
|
|
57
57
|
|
|
58
58
|
module.exports = makeSchema(
|
|
59
59
|
BasicActionOperationSchema,
|
|
60
|
-
BasicOperationSchema.dependencies
|
|
60
|
+
BasicOperationSchema.dependencies,
|
|
61
61
|
);
|
|
@@ -10,7 +10,7 @@ const RequestSchema = require('./RequestSchema');
|
|
|
10
10
|
// TODO: would be nice to deep merge these instead
|
|
11
11
|
// or maybe use allOf which is built into json-schema
|
|
12
12
|
const BasicCreateActionOperationSchema = JSON.parse(
|
|
13
|
-
JSON.stringify(BasicActionOperationSchema.schema)
|
|
13
|
+
JSON.stringify(BasicActionOperationSchema.schema),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
BasicCreateActionOperationSchema.id = '/BasicCreateActionOperationSchema';
|
|
@@ -63,5 +63,5 @@ delete BasicCreateActionOperationSchema.required;
|
|
|
63
63
|
|
|
64
64
|
module.exports = makeSchema(
|
|
65
65
|
BasicCreateActionOperationSchema,
|
|
66
|
-
BasicActionOperationSchema.dependencies.concat(BufferConfigSchema)
|
|
66
|
+
BasicActionOperationSchema.dependencies.concat(BufferConfigSchema),
|
|
67
67
|
);
|
|
@@ -10,7 +10,7 @@ const RequestSchema = require('./RequestSchema');
|
|
|
10
10
|
// TODO: would be nice to deep merge these instead
|
|
11
11
|
// or maybe use allOf which is built into json-schema
|
|
12
12
|
const BasicHookOperationSchema = JSON.parse(
|
|
13
|
-
JSON.stringify(BasicOperationSchema.schema)
|
|
13
|
+
JSON.stringify(BasicOperationSchema.schema),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
const hookTechnicallyRequired =
|
|
@@ -113,5 +113,5 @@ BasicHookOperationSchema.antiExamples = [
|
|
|
113
113
|
|
|
114
114
|
module.exports = makeSchema(
|
|
115
115
|
BasicHookOperationSchema,
|
|
116
|
-
BasicOperationSchema.dependencies
|
|
116
|
+
BasicOperationSchema.dependencies,
|
|
117
117
|
);
|
|
@@ -10,7 +10,7 @@ const RequestSchema = require('./RequestSchema');
|
|
|
10
10
|
// TODO: would be nice to deep merge these instead
|
|
11
11
|
// or maybe use allOf which is built into json-schema
|
|
12
12
|
const BasicHookToPollOperationSchema = JSON.parse(
|
|
13
|
-
JSON.stringify(BasicOperationSchema.schema)
|
|
13
|
+
JSON.stringify(BasicOperationSchema.schema),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
BasicHookToPollOperationSchema.id = '/BasicHookToPollOperationSchema';
|
|
@@ -94,5 +94,5 @@ BasicHookToPollOperationSchema.antiExamples = [
|
|
|
94
94
|
|
|
95
95
|
module.exports = makeSchema(
|
|
96
96
|
BasicHookToPollOperationSchema,
|
|
97
|
-
BasicOperationSchema.dependencies
|
|
97
|
+
BasicOperationSchema.dependencies,
|
|
98
98
|
);
|
|
@@ -81,5 +81,13 @@ module.exports = makeSchema(
|
|
|
81
81
|
],
|
|
82
82
|
additionalProperties: false,
|
|
83
83
|
},
|
|
84
|
-
[
|
|
84
|
+
[
|
|
85
|
+
DynamicFieldsSchema,
|
|
86
|
+
FunctionSchema,
|
|
87
|
+
KeySchema,
|
|
88
|
+
LockObjectSchema,
|
|
89
|
+
RequestSchema,
|
|
90
|
+
ResultsSchema,
|
|
91
|
+
ThrottleObjectSchema,
|
|
92
|
+
],
|
|
85
93
|
);
|
|
@@ -7,7 +7,7 @@ const BasicOperationSchema = require('./BasicOperationSchema');
|
|
|
7
7
|
// TODO: would be nice to deep merge these instead
|
|
8
8
|
// or maybe use allOf which is built into json-schema
|
|
9
9
|
const BasicPollingOperationSchema = JSON.parse(
|
|
10
|
-
JSON.stringify(BasicOperationSchema.schema)
|
|
10
|
+
JSON.stringify(BasicOperationSchema.schema),
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
BasicPollingOperationSchema.id = '/BasicPollingOperationSchema';
|
|
@@ -38,5 +38,5 @@ BasicPollingOperationSchema.properties = {
|
|
|
38
38
|
|
|
39
39
|
module.exports = makeSchema(
|
|
40
40
|
BasicPollingOperationSchema,
|
|
41
|
-
BasicOperationSchema.dependencies
|
|
41
|
+
BasicOperationSchema.dependencies,
|
|
42
42
|
);
|
|
@@ -17,7 +17,7 @@ module.exports = makeSchema({
|
|
|
17
17
|
},
|
|
18
18
|
sample: {
|
|
19
19
|
description:
|
|
20
|
-
|
|
20
|
+
'A legacy field that is no longer used by the editor, but it is still required for now and should match the value.',
|
|
21
21
|
type: 'string',
|
|
22
22
|
minLength: 1,
|
|
23
23
|
},
|
package/lib/utils/buildDocs.js
CHANGED
|
@@ -59,7 +59,7 @@ const formatExample = (example) => {
|
|
|
59
59
|
return `* ${quoteOrNa(
|
|
60
60
|
util.inspect(ex, { depth: null, breakLength: BREAK_LENGTH }),
|
|
61
61
|
true,
|
|
62
|
-
' '
|
|
62
|
+
' ',
|
|
63
63
|
)}`.replace(/\s+\n/gm, '\n');
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -205,7 +205,7 @@ const buildDocs = (InitSchema) => {
|
|
|
205
205
|
# \`zapier-platform-schema\` Generated Documentation
|
|
206
206
|
|
|
207
207
|
This is automatically generated by the \`npm run docs\` command in \`zapier-platform-schema\` version ${quoteOrNa(
|
|
208
|
-
packageJson.version
|
|
208
|
+
packageJson.version,
|
|
209
209
|
)}.
|
|
210
210
|
|
|
211
211
|
-----
|
|
@@ -45,7 +45,7 @@ const processBaseError = (err, path) => {
|
|
|
45
45
|
// the subschemas have a type property
|
|
46
46
|
err.message = err.message.replace(
|
|
47
47
|
subschema,
|
|
48
|
-
err.schema[err.name][idx].type || 'unknown'
|
|
48
|
+
err.schema[err.name][idx].type || 'unknown',
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
@@ -105,8 +105,8 @@ const cleanError = (validationError, path, validator, definition) => {
|
|
|
105
105
|
e,
|
|
106
106
|
makePath(path, validationError.property),
|
|
107
107
|
validator,
|
|
108
|
-
definition
|
|
109
|
-
)
|
|
108
|
+
definition,
|
|
109
|
+
),
|
|
110
110
|
);
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -131,10 +131,10 @@ const makeValidator = (mainSchema, subSchemas) => {
|
|
|
131
131
|
validate: (definition) => {
|
|
132
132
|
const results = v.validate(definition, mainSchema);
|
|
133
133
|
const allErrors = results.errors.concat(
|
|
134
|
-
functionalConstraints.run(definition, mainSchema)
|
|
134
|
+
functionalConstraints.run(definition, mainSchema),
|
|
135
135
|
);
|
|
136
136
|
const cleanedErrors = flattenDeep(
|
|
137
|
-
allErrors.map((e) => cleanError(e, '', v, definition))
|
|
137
|
+
allErrors.map((e) => cleanError(e, '', v, definition)),
|
|
138
138
|
);
|
|
139
139
|
|
|
140
140
|
results.errors = cleanedErrors.map((error) => {
|
package/package.json
CHANGED