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

Commit

Permalink
Merge pull request #44 from zapier/hook-type
Browse files Browse the repository at this point in the history
add doc annotation for hook type
  • Loading branch information
xavdid authored May 2, 2018
2 parents 16c879b + d09e88f commit b7788ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/build/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Represents the inbound mechanics of hooks with optional subscribe/unsubscribe. D

Key | Required | Type | Description
--- | -------- | ---- | -----------
`type` | no | `string` in (`'hook'`) | Clarify how this operation works (polling == pull or hook == push).
`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.
Expand Down
11 changes: 8 additions & 3 deletions exported-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,15 @@
"properties": {
"type": {
"description":
"Clarify how this operation works (polling == pull or hook == push).",
"Must be explicitly set to `\"hook\"` unless this hook is defined as part of a resource, in which case it's optional.",
"type": "string",
"default": "hook",
"enum": ["hook"]
"enum": ["hook"],
"docAnnotation": {
"required": {
"type": "replace",
"value": "**yes** (with exceptions, see description)"
}
}
},
"resource": {
"description":
Expand Down
12 changes: 8 additions & 4 deletions lib/schemas/BasicHookOperationSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ BasicHookOperationSchema.description =

BasicHookOperationSchema.properties = {
type: {
// TODO: not a fan of this...
description:
'Clarify how this operation works (polling == pull or hook == push).',
'Must be explicitly set to `"hook"` unless this hook is defined as part of a resource, in which case it\'s optional.',
type: 'string',
default: 'hook',
enum: ['hook']
enum: ['hook'],
docAnnotation: {
required: {
type: 'replace',
value: '**yes** (with exceptions, see description)'
}
}
},
resource: BasicHookOperationSchema.properties.resource,
perform: {
Expand Down

0 comments on commit b7788ef

Please sign in to comment.