diff --git a/modules/openapi-generator/src/main/resources/zapier/actions.mustache b/modules/openapi-generator/src/main/resources/zapier/actions.mustache index 4d596866ac95..294493c12427 100644 --- a/modules/openapi-generator/src/main/resources/zapier/actions.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/actions.mustache @@ -3,7 +3,7 @@ const {{classname}} = require('../{{apiPackage}}/{{classname}}'); {{/apis}} {{/apiInfo}} -const { triggerMiddleware, isTrigger, searchMiddleware, hasSearchRequisites, isSearchAction } = require('../utils/utils'); +const { triggerMiddleware, isTrigger, searchMiddleware, hasSearchRequisites, isSearchAction, isCreateAction } = require('../utils/utils'); const actions = { {{#apiInfo}} @@ -19,6 +19,6 @@ const actions = { module.exports = { searchActions: () => Object.entries(actions).reduce((actions, [key, value]) => isSearchAction(key) && hasSearchRequisites(value) ? {...actions, [key]: searchMiddleware(value)} : actions, {}), - createActions: () => Object.entries(actions).reduce((actions, [key, value]) => !isSearchAction(key) ? {...actions, [key]: value} : actions, {}), + createActions: () => Object.entries(actions).reduce((actions, [key, value]) => isCreateAction(key) ? {...actions, [key]: value} : actions, {}), triggers: () => Object.entries(actions).reduce((actions, [key, value]) => isTrigger(key) ? {...actions, [key]: triggerMiddleware(value)} : actions, {}), } diff --git a/modules/openapi-generator/src/main/resources/zapier/api.mustache b/modules/openapi-generator/src/main/resources/zapier/api.mustache index fe97160e29e7..7b49251f5609 100644 --- a/modules/openapi-generator/src/main/resources/zapier/api.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/api.mustache @@ -84,7 +84,6 @@ module.exports = { method: '{{httpMethod}}', removeMissingValuesFrom: { params: true, body: true }, headers: { - 'x-api-key': '{{=<% %>=}}{{bundle.authData.apiKey}}<%={{ }}=%>', {{^isMultipart}}'Content-Type': '{{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}',{{/isMultipart}} 'Accept': '{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}', }, diff --git a/modules/openapi-generator/src/main/resources/zapier/utils.mustache b/modules/openapi-generator/src/main/resources/zapier/utils.mustache index 07c4915aaae3..7690a1cda1ea 100644 --- a/modules/openapi-generator/src/main/resources/zapier/utils.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/utils.mustache @@ -23,6 +23,11 @@ const searchMiddleware = (action) => { return action } +const isCreateAction = (key) => { + // TODO: return true if the key is a "create" action for your API + return !isSearchAction(key); +} + const requestOptionsMiddleware = (z, bundle, requestOptions) => { // TODO: modify the request options for all outgoing request to your api // if you are using session authentication without a Bearer token. @@ -50,4 +55,5 @@ module.exports = { requestOptionsMiddleware: requestOptionsMiddleware, isTrigger: isTrigger, triggerMiddleware: triggerMiddleware, + isCreateAction: isCreateAction, }