Skip to content

Commit

Permalink
chore: update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wallen committed Sep 22, 2024
1 parent e216596 commit 809c5cf
Show file tree
Hide file tree
Showing 76 changed files with 177 additions and 188 deletions.
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 @@ -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
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 @@ -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 @@ -64,14 +64,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 @@ -61,14 +61,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 @@ -61,14 +61,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
30 changes: 3 additions & 27 deletions samples/client/petstore/zapier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ This generator generates a partial implementation of a zapier integration from a

It's a partial integration because you have to put in some code for it to be 100% complete, code that depends only on how your api is structured.

Here there are all the parts you need to complete by yourself:
Here there are all the parts you need to complete by yourself:

### 1) **utils/utils.js** isSearchAction method

This method has to return either true or false if a method is a [zapier search action](https://platform.zapier.com/docs/search-create).

```
const isSearchAction = (key) => {
// TODO: custom logic
Expand All @@ -20,7 +18,6 @@ const isSearchAction = (key) => {
```

### 2) **utils/utils.js** searchMiddleware method

This method has to return an array of resources (searches must return an array), if you have pagination or you api returns an array inside nested fields, here you have to extract the array.

```
Expand All @@ -30,34 +27,13 @@ const searchMiddleware = (action) => {
}
```

### 3) **utils/utils.js** isTrigger method

This method has to return either true or false if a method is a [zapier search action](https://platform.zapier.com/docs/search-create).

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

### 4) **utils/utils.js** searchMiddleware method

```
const triggerMiddleware = (action) => {
return action
}
```

### 3) **authentication.js**

This file must be written completely according to your api authentication, you can get it generated automatically by creating the integration on the zapier website and filling the requested data, or you can build it yourself following [this guide](https://platform.zapier.com/cli_tutorials/getting-started#adding-authentication).

## Samples
To get your app made public on zapier you must provide a sample (json example response) for each of your actions, these samples get automatically generated by this generator but you have to have actual response examples in you openapi file.

To get your app made public on zapier you must provide a sample (json example response) for each of your actions, these samples get automatically generated by this generator but you have to have actual response examples in you openapi file.

For example:
For example:

```
CreateUserResponse:
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(),
};
5 changes: 3 additions & 2 deletions samples/client/petstore/zapier/operations/actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 = {
[PetApi.addPet.key]: PetApi.addPet,
Expand Down Expand Up @@ -29,4 +29,5 @@ 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, {}),
}
triggers: () => Object.entries(actions).reduce((actions, [key, value]) => isTrigger(key) ? {...actions, [key]: triggerMiddleware(value)} : actions, {}),
}
11 changes: 11 additions & 0 deletions samples/client/petstore/zapier/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const requestOptionsMiddleware = (z, bundle, requestOptions) => {
return requestOptions
}

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

const triggerMiddleware = (action) => {
return action
}

module.exports = {
replacePathParameters: replacePathParameters,
childMapping: childMapping,
Expand All @@ -39,4 +48,6 @@ module.exports = {
isSearchAction: isSearchAction,
searchMiddleware: searchMiddleware,
requestOptionsMiddleware: requestOptionsMiddleware,
isTrigger: isTrigger,
triggerMiddleware: triggerMiddleware,
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public virtual IActionResult FakeNullableExampleTest()
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(TestNullable));
string exampleJson = null;
exampleJson = "{\n \"nullableName\" : \"nullableName\",\n \"name\" : \"name\"\n}";
exampleJson = "{\r\n \"nullableName\" : \"nullableName\",\r\n \"name\" : \"name\"\r\n}";

var example = exampleJson != null
? JsonConvert.DeserializeObject<TestNullable>(exampleJson)
Expand Down
Loading

0 comments on commit 809c5cf

Please sign in to comment.