Skip to content

Commit

Permalink
Merge pull request #973 from zapier/PDE-5773
Browse files Browse the repository at this point in the history
fix(schema): Reference the proper FieldSchema as necessary
  • Loading branch information
kola-er authored Feb 18, 2025
2 parents a6f4867 + 1518ca1 commit 061f030
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/core/types/zapier.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export interface AuthField {
*
* @minItems 1
*/
children?: Field[];
children?: AuthField[];

/** Is this field a key/value input? */
dict?: boolean;
Expand Down Expand Up @@ -703,7 +703,7 @@ export interface InputField {
*
* @minItems 1
*/
children?: Field[];
children?: InputField[];

/** Is this field a key/value input? */
dict?: boolean;
Expand Down Expand Up @@ -807,7 +807,7 @@ export interface OutputField {
*
* @minItems 1
*/
children?: Field[];
children?: OutputField[];

/** Is this field a key/value input? */
dict?: boolean;
Expand Down
10 changes: 5 additions & 5 deletions packages/schema/docs/build/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Key | Required | Type | Description
`required` | no | `boolean` | If this value is required or not. This defaults to `true`.
`default` | no | `string` | A default value that is saved the first time a Zap is created.
`list` | no | `boolean` | Acts differently when used in inputFields vs. when used in outputFields. In inputFields: Can a user provide multiples of this field? In outputFields: Does this field return an array of items of type `type`?
`children` | no | `array`[undefined] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`children` | no | `array`[[/AuthFieldSchema](#authfieldschema)] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`dict` | no | `boolean` | Is this field a key/value input?
`helpText` | no | `string` | A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.
`placeholder` | no | `string` | An example value that is not saved.
Expand Down Expand Up @@ -1229,7 +1229,7 @@ Key | Required | Type | Description
`required` | no | `boolean` | If this value is required or not.
`default` | no | `string` | A default value that is saved the first time a Zap is created.
`list` | no | `boolean` | Acts differently when used in inputFields vs. when used in outputFields. In inputFields: Can a user provide multiples of this field? In outputFields: Does this field return an array of items of type `type`?
`children` | no | `array`[undefined] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`children` | no | `array`[[/InputFieldSchema](#inputfieldschema)] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`dict` | no | `boolean` | Is this field a key/value input?
`helpText` | no | `string` | A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.
`dynamic` | no | [/RefResourceSchema](#refresourceschema) | A reference to a trigger that will power a dynamic dropdown.
Expand Down Expand Up @@ -1265,7 +1265,7 @@ Key | Required | Type | Description
* `{ key: 'abc', choices: [ 3 ] }` - _Invalid value for key: choices (if an array, must be of either string or FieldChoiceWithLabelSchema)_
* `{ key: 'abc', choices: [ { label: 'Red', value: '#f00' } ] }` - _Invalid value for key: choices (if an array of FieldChoiceWithLabelSchema, must provide key `sample`)_
* `{ key: 'abc', choices: 'mobile' }` - _Invalid value for key: choices (must be either object or array)_
* `{ key: 'abc', children: [ '$func$2$f$' ] }` - _Invalid value for key: children (must be array of FieldSchema)_
* `{ key: 'abc', children: [ '$func$2$f$' ] }` - _Invalid value for key: children (must be array of InputFieldSchema)_

-----

Expand Down Expand Up @@ -1375,7 +1375,7 @@ Key | Required | Type | Description
`required` | no | `boolean` | If this value is required or not.
`default` | no | `string` | A default value that is saved the first time a Zap is created.
`list` | no | `boolean` | Acts differently when used in inputFields vs. when used in outputFields. In inputFields: Can a user provide multiples of this field? In outputFields: Does this field return an array of items of type `type`?
`children` | no | `array`[undefined] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`children` | no | `array`[[/OutputFieldSchema](#outputfieldschema)] | An array of child fields that define the structure of a sub-object for this field. Usually used for line items.
`dict` | no | `boolean` | Is this field a key/value input?
`primary` | no | `boolean` | Use this field as part of the primary key for deduplication. You can set multiple fields as "primary", provided they are unique together. If no fields are set, Zapier will default to using the `id` field. `primary` only makes sense for `outputFields`. It only works in static `outputFields`; will not work in custom/dynamic `outputFields`. For more information, see [How deduplication works in Zapier](https://platform.zapier.com/build/deduplication).
`steadyState` | no | `boolean` | Prevents triggering on new output until all values for fields with this property remain unchanged for 2 polls. It can be used to, e.g., not trigger on a new contact until the contact has completed typing their name. NOTE that this only applies to the `outputFields` of polling triggers.
Expand All @@ -1396,7 +1396,7 @@ Key | Required | Type | Description
* `{ key: 'abc', choices: [ 3 ] }` - _Invalid value for key: choices (if an array, must be of either string or FieldChoiceWithLabelSchema)_
* `{ key: 'abc', choices: [ { label: 'Red', value: '#f00' } ] }` - _Invalid value for key: choices (if an array of FieldChoiceWithLabelSchema, must provide key `sample`)_
* `{ key: 'abc', choices: 'mobile' }` - _Invalid value for key: choices (must be either object or array)_
* `{ key: 'abc', children: [ '$func$2$f$' ] }` - _Invalid value for key: children (must be array of FieldSchema)_
* `{ key: 'abc', children: [ '$func$2$f$' ] }` - _Invalid value for key: children (must be array of OutputFieldSchema)_

-----

Expand Down
6 changes: 3 additions & 3 deletions packages/schema/exported-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
"children": {
"type": "array",
"items": {
"$ref": "/FieldSchema"
"$ref": "/AuthFieldSchema"
},
"description": "An array of child fields that define the structure of a sub-object for this field. Usually used for line items.",
"minItems": 1
Expand Down Expand Up @@ -710,7 +710,7 @@
"children": {
"type": "array",
"items": {
"$ref": "/FieldSchema"
"$ref": "/InputFieldSchema"
},
"description": "An array of child fields that define the structure of a sub-object for this field. Usually used for line items.",
"minItems": 1
Expand Down Expand Up @@ -802,7 +802,7 @@
"children": {
"type": "array",
"items": {
"$ref": "/FieldSchema"
"$ref": "/OutputFieldSchema"
},
"description": "An array of child fields that define the structure of a sub-object for this field. Usually used for line items.",
"minItems": 1
Expand Down
7 changes: 7 additions & 0 deletions packages/schema/lib/schemas/AuthFieldSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ module.exports = makeSchema(
type: 'object',
properties: {
...FieldSchema.schema.properties,
children: {
type: 'array',
items: { $ref: '/AuthFieldSchema' },
description:
'An array of child fields that define the structure of a sub-object for this field. Usually used for line items.',
minItems: 1,
},
helpText: {
description:
'A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.',
Expand Down
9 changes: 8 additions & 1 deletion packages/schema/lib/schemas/InputFieldSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ module.exports = makeSchema(
required: ['key'],
properties: {
...FieldSchema.schema.properties,
children: {
type: 'array',
items: { $ref: '/InputFieldSchema' },
description:
'An array of child fields that define the structure of a sub-object for this field. Usually used for line items.',
minItems: 1,
},
helpText: {
description:
'A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.',
Expand Down Expand Up @@ -115,7 +122,7 @@ module.exports = makeSchema(
{
example: { key: 'abc', children: ['$func$2$f$'] },
reason:
'Invalid value for key: children (must be array of FieldSchema)',
'Invalid value for key: children (must be array of InputFieldSchema)',
},
],
additionalProperties: false,
Expand Down
9 changes: 8 additions & 1 deletion packages/schema/lib/schemas/OutputFieldSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ module.exports = makeSchema(
required: ['key'],
properties: {
...FieldSchema.schema.properties,
children: {
type: 'array',
items: { $ref: '/OutputFieldSchema' },
description:
'An array of child fields that define the structure of a sub-object for this field. Usually used for line items.',
minItems: 1,
},
type: {
description:
'The type of this value. Field type of `file` will accept either a file object or a string. If a URL is provided in the string, Zapier will automatically make a GET for that file. Otherwise, a .txt file will be generated.',
Expand Down Expand Up @@ -72,7 +79,7 @@ module.exports = makeSchema(
{
example: { key: 'abc', children: ['$func$2$f$'] },
reason:
'Invalid value for key: children (must be array of FieldSchema)',
'Invalid value for key: children (must be array of OutputFieldSchema)',
},
],
additionalProperties: false,
Expand Down

0 comments on commit 061f030

Please sign in to comment.