Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make it easier to specify triggers for Zapier #18814

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/generators/fsharp-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |OpenAPI/src|
|sourceFolder|source folder for generated code| |OpenAPI\src|

## IMPORT MAPPING

Expand Down
2 changes: 1 addition & 1 deletion docs/generators/fsharp-giraffe-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|packageVersion|F# package version.| |1.0.0|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |OpenAPI/src|
|sourceFolder|source folder for generated code| |OpenAPI\src|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |false|
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/java-inflector.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/gen/java|
|sourceFolder|source folder for generated code| |src\gen\java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/jaxrs-cxf-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/gen/java|
|sourceFolder|source folder for generated code| |src\gen\java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk.| |false|
|useBeanValidation|Use BeanValidation API annotations| |false|
Expand Down
4 changes: 2 additions & 2 deletions docs/generators/swift5.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine, AsyncAwait are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null|
|swiftPackagePath|Set a custom source path instead of OpenAPIClient\Classes\OpenAPIs.| |null|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|useClasses|Use final classes for models instead of structs (default: false)| |false|
|useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false|
|useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources\{{projectName}} (default: false).| |null|
|validatable|Make validation rules and validator for model properies (default: true)| |true|

## IMPORT MAPPING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const {{classname}} = require('../{{apiPackage}}/{{classname}}');
{{/apis}}
{{/apiInfo}}
const { searchMiddleware, hasSearchRequisites, isSearchAction } = require('../utils/utils');
const { triggerMiddleware, isTrigger, searchMiddleware, hasSearchRequisites, isSearchAction } = require('../utils/utils');

const actions = {
const operations = {
{{#apiInfo}}
{{#apis}}
{{#operations}}
Expand All @@ -18,6 +18,7 @@ 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, {}),
}
searchActions: () => Object.entries(operations).reduce((operations, [key, value]) => isSearchAction(key) && hasSearchRequisites(value) ? {...operations, [key]: searchMiddleware(value)} : operations, {}),
createActions: () => Object.entries(operations).reduce((operations, [key, value]) => !isSearchAction(key) ? {...operations, [key]: value} : operations, {}),
triggers: () => Object.entries(operations).reduce((operations, [key, value]) => isTrigger(key) ? {...operations, [key]: triggerMiddleware(value)} : operations, {}),
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const authentication = require('./authentication');
const { searchActions, createActions } = require('./operations/actions');
const { searchActions, createActions, triggers } = require('./operations/actions');

module.exports = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication: authentication,
searches: searchActions(),
creates: createActions(),
triggers: triggers(),
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ const searchMiddleware = (action) => {
return action
}

const isTrigger = (key) => {
// TODO: custom logic
return false
}
const triggerMiddleware = (action) => {
return action
}

module.exports = {
replacePathParameters: replacePathParameters,
childMapping: childMapping,
Expand All @@ -31,4 +39,6 @@ module.exports = {
hasSearchRequisites: hasSearchRequisites,
isSearchAction: isSearchAction,
searchMiddleware: searchMiddleware,
}
isTrigger: isTrigger,
triggerMiddleware: triggerMiddleware,
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
git_push.sh
phpunit.xml.dist
src/ApiException.php
src/Api/AuthApi.php
src/Api/BodyApi.php
src/Api/FormApi.php
src/Api/HeaderApi.php
src/Api/PathApi.php
src/Api/QueryApi.php
src/ApiException.php
src/Configuration.php
src/HeaderSelector.php
src/Model/Bird.php
Expand Down
4 changes: 2 additions & 2 deletions samples/client/echo_api/php-nextgen/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/Api</directory>
<directory suffix=".php">./src/Model</directory>
<directory suffix=".php">./src\/Api</directory>
<directory suffix=".php">./src\/Model</directory>
</include>
</coverage>
<testsuites>
Expand Down
2 changes: 1 addition & 1 deletion samples/client/echo_api/r/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.travis.yml
DESCRIPTION
NAMESPACE
README.md
R/api_client.R
R/api_response.R
R/auth_api.R
Expand All @@ -25,7 +26,6 @@ R/tag.R
R/test_form_object_multipart_request_marker.R
R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R
R/test_query_style_form_explode_true_array_string_query_object_parameter.R
README.md
docs/AuthApi.md
docs/Bird.md
docs/BodyApi.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.travis.yml
DESCRIPTION
NAMESPACE
README.md
R/allof_tag_api_response.R
R/animal.R
R/any_of_pig.R
Expand Down Expand Up @@ -39,7 +40,6 @@ R/user.R
R/user_api.R
R/whale.R
R/zebra.R
README.md
docs/AllofTagApiResponse.md
docs/Animal.md
docs/AnyOfPig.md
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/R-httr2/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.travis.yml
DESCRIPTION
NAMESPACE
README.md
R/allof_tag_api_response.R
R/animal.R
R/any_of_pig.R
Expand Down Expand Up @@ -38,7 +39,6 @@ R/user.R
R/user_api.R
R/whale.R
R/zebra.R
README.md
docs/AllofTagApiResponse.md
docs/Animal.md
docs/AnyOfPig.md
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/R/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.travis.yml
DESCRIPTION
NAMESPACE
README.md
R/allof_tag_api_response.R
R/animal.R
R/any_of_pig.R
Expand Down Expand Up @@ -38,7 +39,6 @@ R/user.R
R/user_api.R
R/whale.R
R/zebra.R
README.md
docs/AllofTagApiResponse.md
docs/Animal.md
docs/AnyOfPig.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ docs/Model/TestInlineFreeformAdditionalPropertiesRequest.md
docs/Model/User.md
git_push.sh
phpunit.xml.dist
src/ApiException.php
src/Api/AnotherFakeApi.php
src/Api/DefaultApi.php
src/Api/FakeApi.php
src/Api/FakeClassnameTags123Api.php
src/Api/PetApi.php
src/Api/StoreApi.php
src/Api/UserApi.php
src/ApiException.php
src/Configuration.php
src/HeaderSelector.php
src/Model/AdditionalPropertiesClass.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/Api</directory>
<directory suffix=".php">./src/Model</directory>
<directory suffix=".php">./src\/Api</directory>
<directory suffix=".php">./src\/Model</directory>
</include>
</coverage>
<testsuites>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ docs/Model/Tag.md
docs/Model/TestInlineFreeformAdditionalPropertiesRequest.md
docs/Model/User.md
git_push.sh
lib/ApiException.php
lib/Api/AnotherFakeApi.php
lib/Api/DefaultApi.php
lib/Api/FakeApi.php
lib/Api/FakeClassnameTags123Api.php
lib/Api/PetApi.php
lib/Api/StoreApi.php
lib/Api/UserApi.php
lib/ApiException.php
lib/Configuration.php
lib/HeaderSelector.php
lib/Model/AdditionalPropertiesClass.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ docs/Model/Tag.md
docs/Model/TestInlineFreeformAdditionalPropertiesRequest.md
docs/Model/User.md
git_push.sh
lib/ApiException.php
lib/Api/AnotherFakeApi.php
lib/Api/DefaultApi.php
lib/Api/FakeApi.php
lib/Api/FakeClassnameTags123Api.php
lib/Api/PetApi.php
lib/Api/StoreApi.php
lib/Api/UserApi.php
lib/ApiException.php
lib/Configuration.php
lib/DebugPlugin.php
lib/HeaderSelector.php
Expand Down
3 changes: 2 additions & 1 deletion samples/client/petstore/zapier/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const authentication = require('./authentication');
const { searchActions, createActions } = require('./operations/actions');
const { searchActions, createActions, triggers } = require('./operations/actions');

module.exports = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication: authentication,
searches: searchActions(),
creates: createActions(),
triggers: triggers(),
};
11 changes: 6 additions & 5 deletions samples/client/petstore/zapier/operations/actions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const PetApi = require('../apis/PetApi');
const StoreApi = require('../apis/StoreApi');
const UserApi = require('../apis/UserApi');
const { searchMiddleware, hasSearchRequisites, isSearchAction } = require('../utils/utils');
const { triggerMiddleware, isTrigger, searchMiddleware, hasSearchRequisites, isSearchAction } = require('../utils/utils');

const actions = {
const operations = {
[PetApi.addPet.key]: PetApi.addPet,
[PetApi.deletePet.key]: PetApi.deletePet,
[PetApi.findPetsByStatus.key]: PetApi.findPetsByStatus,
Expand All @@ -27,6 +27,7 @@ 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, {}),
}
searchActions: () => Object.entries(operations).reduce((operations, [key, value]) => isSearchAction(key) && hasSearchRequisites(value) ? {...operations, [key]: searchMiddleware(value)} : operations, {}),
createActions: () => Object.entries(operations).reduce((operations, [key, value]) => !isSearchAction(key) ? {...operations, [key]: value} : operations, {}),
triggers: () => Object.entries(operations).reduce((operations, [key, value]) => isTrigger(key) ? {...operations, [key]: triggerMiddleware(value)} : operations, {}),
}
12 changes: 11 additions & 1 deletion samples/client/petstore/zapier/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ const searchMiddleware = (action) => {
return action
}

const isTrigger = (key) => {
// TODO: custom logic
return false
}
const triggerMiddleware = (action) => {
return action
}

module.exports = {
replacePathParameters: replacePathParameters,
childMapping: childMapping,
Expand All @@ -31,4 +39,6 @@ module.exports = {
hasSearchRequisites: hasSearchRequisites,
isSearchAction: isSearchAction,
searchMiddleware: searchMiddleware,
}
isTrigger: isTrigger,
triggerMiddleware: triggerMiddleware,
}
Loading