From 178b8a7737e8506e42ccee25951be3c08aaed4e3 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi <48432054+emajo@users.noreply.github.com> Date: Tue, 18 Jul 2023 18:36:43 +0200 Subject: [PATCH] Zapier generator api template improvement (#16121) * minor zapier api template fixes * updated samples * added zapier validation action * readded zapier beta tags * fixed zapier validation action * updated samples * improved zapier api names * updated samples * fixed zapier noun and label --- .../src/main/resources/zapier/api.mustache | 4 +-- samples/client/petstore/zapier/apis/PetApi.js | 32 +++++++++---------- .../client/petstore/zapier/apis/StoreApi.js | 16 +++++----- .../client/petstore/zapier/apis/UserApi.js | 32 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/zapier/api.mustache b/modules/openapi-generator/src/main/resources/zapier/api.mustache index ce417d39c4a..cb56c783b93 100644 --- a/modules/openapi-generator/src/main/resources/zapier/api.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/api.mustache @@ -15,9 +15,9 @@ module.exports = { {{#operation}} {{operationId}}: { key: '{{operationId}}', - noun: '{{baseName}}', + noun: '{{#tags}}{{name}}{{/tags}}', display: { - label: '{{operationId}}', + label: '{{summary}}', description: '{{#notes}}{{.}}{{/notes}}', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/PetApi.js b/samples/client/petstore/zapier/apis/PetApi.js index 12eab471316..f5a3465c922 100644 --- a/samples/client/petstore/zapier/apis/PetApi.js +++ b/samples/client/petstore/zapier/apis/PetApi.js @@ -7,9 +7,9 @@ const FormData = require('form-data'); module.exports = { addPet: { key: 'addPet', - noun: 'Pet', + noun: 'pet', display: { - label: 'addPet', + label: 'Add a new pet to the store', description: '', hidden: false, }, @@ -47,9 +47,9 @@ module.exports = { }, deletePet: { key: 'deletePet', - noun: 'Pet', + noun: 'pet', display: { - label: 'deletePet', + label: 'Deletes a pet', description: '', hidden: false, }, @@ -95,9 +95,9 @@ module.exports = { }, findPetsByStatus: { key: 'findPetsByStatus', - noun: 'Pet', + noun: 'pet', display: { - label: 'findPetsByStatus', + label: 'Finds Pets by status', description: 'Multiple status values can be provided with comma separated strings', hidden: false, }, @@ -138,9 +138,9 @@ module.exports = { }, findPetsByTags: { key: 'findPetsByTags', - noun: 'Pet', + noun: 'pet', display: { - label: 'findPetsByTags', + label: 'Finds Pets by tags', description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.', hidden: false, }, @@ -181,9 +181,9 @@ module.exports = { }, getPetById: { key: 'getPetById', - noun: 'Pet', + noun: 'pet', display: { - label: 'getPetById', + label: 'Find pet by ID', description: 'Returns a single pet', hidden: false, }, @@ -225,9 +225,9 @@ module.exports = { }, updatePet: { key: 'updatePet', - noun: 'Pet', + noun: 'pet', display: { - label: 'updatePet', + label: 'Update an existing pet', description: '', hidden: false, }, @@ -265,9 +265,9 @@ module.exports = { }, updatePetWithForm: { key: 'updatePetWithForm', - noun: 'Pet', + noun: 'pet', display: { - label: 'updatePetWithForm', + label: 'Updates a pet in the store with form data', description: '', hidden: false, }, @@ -318,9 +318,9 @@ module.exports = { }, uploadFile: { key: 'uploadFile', - noun: 'Pet', + noun: 'pet', display: { - label: 'uploadFile', + label: 'uploads an image', description: '', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/StoreApi.js b/samples/client/petstore/zapier/apis/StoreApi.js index 7371fdf1e7e..da883c1377a 100644 --- a/samples/client/petstore/zapier/apis/StoreApi.js +++ b/samples/client/petstore/zapier/apis/StoreApi.js @@ -5,9 +5,9 @@ const utils = require('../utils/utils'); module.exports = { deleteOrder: { key: 'deleteOrder', - noun: 'Store', + noun: 'store', display: { - label: 'deleteOrder', + label: 'Delete purchase order by ID', description: 'For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors', hidden: false, }, @@ -48,9 +48,9 @@ module.exports = { }, getInventory: { key: 'getInventory', - noun: 'Store', + noun: 'store', display: { - label: 'getInventory', + label: 'Returns pet inventories by status', description: 'Returns a map of status codes to quantities', hidden: false, }, @@ -85,9 +85,9 @@ module.exports = { }, getOrderById: { key: 'getOrderById', - noun: 'Store', + noun: 'store', display: { - label: 'getOrderById', + label: 'Find purchase order by ID', description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions', hidden: false, }, @@ -129,9 +129,9 @@ module.exports = { }, placeOrder: { key: 'placeOrder', - noun: 'Store', + noun: 'store', display: { - label: 'placeOrder', + label: 'Place an order for a pet', description: '', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/UserApi.js b/samples/client/petstore/zapier/apis/UserApi.js index c5ec0831dc6..aac909ffd1b 100644 --- a/samples/client/petstore/zapier/apis/UserApi.js +++ b/samples/client/petstore/zapier/apis/UserApi.js @@ -5,9 +5,9 @@ const utils = require('../utils/utils'); module.exports = { createUser: { key: 'createUser', - noun: 'User', + noun: 'user', display: { - label: 'createUser', + label: 'Create user', description: 'This can only be done by the logged in user.', hidden: false, }, @@ -44,9 +44,9 @@ module.exports = { }, createUsersWithArrayInput: { key: 'createUsersWithArrayInput', - noun: 'User', + noun: 'user', display: { - label: 'createUsersWithArrayInput', + label: 'Creates list of users with given input array', description: '', hidden: false, }, @@ -87,9 +87,9 @@ module.exports = { }, createUsersWithListInput: { key: 'createUsersWithListInput', - noun: 'User', + noun: 'user', display: { - label: 'createUsersWithListInput', + label: 'Creates list of users with given input array', description: '', hidden: false, }, @@ -130,9 +130,9 @@ module.exports = { }, deleteUser: { key: 'deleteUser', - noun: 'User', + noun: 'user', display: { - label: 'deleteUser', + label: 'Delete user', description: 'This can only be done by the logged in user.', hidden: false, }, @@ -173,9 +173,9 @@ module.exports = { }, getUserByName: { key: 'getUserByName', - noun: 'User', + noun: 'user', display: { - label: 'getUserByName', + label: 'Get user by user name', description: '', hidden: false, }, @@ -217,9 +217,9 @@ module.exports = { }, loginUser: { key: 'loginUser', - noun: 'User', + noun: 'user', display: { - label: 'loginUser', + label: 'Logs user into the system', description: '', hidden: false, }, @@ -268,9 +268,9 @@ module.exports = { }, logoutUser: { key: 'logoutUser', - noun: 'User', + noun: 'user', display: { - label: 'logoutUser', + label: 'Logs out current logged in user session', description: '', hidden: false, }, @@ -305,9 +305,9 @@ module.exports = { }, updateUser: { key: 'updateUser', - noun: 'User', + noun: 'user', display: { - label: 'updateUser', + label: 'Updated user', description: 'This can only be done by the logged in user.', hidden: false, },