Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

(docs) be more clear about whether hook methods are required #58

Merged
merged 2 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/build/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ Key | Required | Type | Description
`type` | **yes** (with exceptions, see description) | `string` in (`'hook'`) | Must be explicitly set to `"hook"` unless this hook is defined as part of a resource, in which case it's optional.
`resource` | no | [/RefResourceSchema](#refresourceschema) | Optionally reference and extends a resource. Allows Zapier to automatically tie together samples, lists and hooks, greatly improving the UX. EG: if you had another trigger reusing a resource but filtering the results.
`perform` | **yes** | [/FunctionSchema](#functionschema) | A function that processes the inbound webhook request.
`performList` | no | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Can get "live" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods.
`performSubscribe` | no | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Takes a URL and any necessary data from the user and subscribes.
`performUnsubscribe` | no | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Takes a URL and data from a previous subscribe call and unsubscribes.
`performList` | **yes** (with exceptions, see description) | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Can get "live" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.
`performSubscribe` | **yes** (with exceptions, see description) | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Takes a URL and any necessary data from the user and subscribes. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.
`performUnsubscribe` | **yes** (with exceptions, see description) | oneOf([/RequestSchema](#requestschema), [/FunctionSchema](#functionschema)) | Takes a URL and data from a previous subscribe call and unsubscribes. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.
`inputFields` | no | [/DynamicFieldsSchema](#dynamicfieldsschema) | What should the form a user sees and configures look like?
`outputFields` | no | [/DynamicFieldsSchema](#dynamicfieldsschema) | What fields of data will this return? Will use resource outputFields if missing, will also use sample if available.
`sample` | **yes** (with exceptions, see description) | `object` | What does a sample of data look like? Will use resource sample if missing. Requirement waived if `display.hidden` is true or if this belongs to a resource that has a top-level sample
Expand Down
30 changes: 24 additions & 6 deletions exported-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -662,39 +662,57 @@
},
"performList": {
"description":
"Can get \"live\" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods.",
"Can get \"live\" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.",
"oneOf": [
{
"$ref": "/RequestSchema"
},
{
"$ref": "/FunctionSchema"
}
]
],
"docAnnotation": {
"required": {
"type": "replace",
"value": "**yes** (with exceptions, see description)"
}
}
},
"performSubscribe": {
"description":
"Takes a URL and any necessary data from the user and subscribes.",
"Takes a URL and any necessary data from the user and subscribes. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.",
"oneOf": [
{
"$ref": "/RequestSchema"
},
{
"$ref": "/FunctionSchema"
}
]
],
"docAnnotation": {
"required": {
"type": "replace",
"value": "**yes** (with exceptions, see description)"
}
}
},
"performUnsubscribe": {
"description":
"Takes a URL and data from a previous subscribe call and unsubscribes.",
"Takes a URL and data from a previous subscribe call and unsubscribes. Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.",
"oneOf": [
{
"$ref": "/RequestSchema"
},
{
"$ref": "/FunctionSchema"
}
]
],
"docAnnotation": {
"required": {
"type": "replace",
"value": "**yes** (with exceptions, see description)"
}
}
},
"inputFields": {
"description":
Expand Down
36 changes: 30 additions & 6 deletions lib/schemas/BasicHookOperationSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const BasicHookOperationSchema = JSON.parse(
JSON.stringify(BasicOperationSchema.schema)
);

const hookTechnicallyRequired =
'Note: this is required for public apps to ensure the best UX for the end-user. For private apps, you can ignore warnings about this property with the `--without-style` flag during `zapier push`.';

BasicHookOperationSchema.id = '/BasicHookOperationSchema';

BasicHookOperationSchema.description =
Expand All @@ -37,18 +40,39 @@ BasicHookOperationSchema.properties = {
},
performList: {
description:
'Can get "live" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods.',
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }]
'Can get "live" data on demand instead of waiting for a hook. If you find yourself reaching for this - consider resources and their built-in hook/list methods. ' +
hookTechnicallyRequired,
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
docAnnotation: {
required: {
type: 'replace',
value: '**yes** (with exceptions, see description)'
}
}
},
performSubscribe: {
description:
'Takes a URL and any necessary data from the user and subscribes.',
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }]
'Takes a URL and any necessary data from the user and subscribes. ' +
hookTechnicallyRequired,
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
docAnnotation: {
required: {
type: 'replace',
value: '**yes** (with exceptions, see description)'
}
}
},
performUnsubscribe: {
description:
'Takes a URL and data from a previous subscribe call and unsubscribes.',
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }]
'Takes a URL and data from a previous subscribe call and unsubscribes. ' +
hookTechnicallyRequired,
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
docAnnotation: {
required: {
type: 'replace',
value: '**yes** (with exceptions, see description)'
}
}
},
inputFields: BasicHookOperationSchema.properties.inputFields,
outputFields: BasicHookOperationSchema.properties.outputFields,
Expand Down
Loading