forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/4.3.x' into 5.0.x
This commit is contained in:
@@ -28,7 +28,7 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
git checkout -- .
|
||||
|
||||
# look for outdated samples
|
||||
./bin/utils/ensure-up-to-date --batch
|
||||
./bin/utils/ensure-up-to-date
|
||||
fi
|
||||
#elif [ "$NODE_INDEX" = "3" ]; then
|
||||
echo "Running node $NODE_INDEX to test haskell"
|
||||
|
||||
@@ -30,7 +30,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client \
|
||||
-i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
|
||||
-g cpp-qt5-client \
|
||||
-c cpp-qt5-petstore.json \
|
||||
-c bin/cpp-qt5-petstore.json \
|
||||
$@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/3_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-objcCompatible.json -o samples/client/petstore/swift4/objcCompatible $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-objcCompatible.json -o samples/client/petstore/swift4/objcCompatible --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekit --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekitLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
@@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswift --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswiftLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift4Test.json -g swift4 -c ./bin/swift4-test.json -o samples/client/test/swift4/default $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift4Test.json -g swift4 -c ./bin/swift4-test.json -o samples/client/test/swift4/default --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"npmName": "@openapitools/typescript-redux-query-petstore",
|
||||
"npmVersion": "1.0.0",
|
||||
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||
"snapshot" : false
|
||||
}
|
||||
32
bin/typescript-redux-query-petstore-with-npm-version.sh
Executable file
32
bin/typescript-redux-query-petstore-with-npm-version.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/typescript-redux-query -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-redux-query -c bin/typescript-redux-query-petstore-with-npm-version.json -o samples/client/petstore/typescript-redux-query/builds/with-npm-version $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
32
bin/typescript-redux-query-petstore.sh
Executable file
32
bin/typescript-redux-query-petstore.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/typescript-redux-query -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-redux-query -o samples/client/petstore/typescript-redux-query/builds/default $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -78,6 +78,7 @@ declare -a samples=(
|
||||
"${root}/bin/dart2-petstore.sh"
|
||||
"${root}/bin/java-play-framework-petstore-server-all.sh"
|
||||
#"${root}/bin/elm-petstore-all.sh"
|
||||
"${root}/bin/typescript-redux-query-petstore-with-npm-version.sh"
|
||||
)
|
||||
|
||||
# Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath)
|
||||
|
||||
10
bin/windows/typescript-redux-query-petstore-with-npm.bat
Executable file
10
bin/windows/typescript-redux-query-petstore-with-npm.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-redux-query-petstore-with-npm-version.json -g typescript-redux-query -o samples\client\petstore\typescript-redux-query\builds\with-npm-version
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
14
bin/windows/typescript-redux-query-petstore.bat
Normal file
14
bin/windows/typescript-redux-query-petstore.bat
Normal file
@@ -0,0 +1,14 @@
|
||||
@ECHO OFF
|
||||
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
|
||||
echo
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-redux-query -o samples\client\petstore\typescript-redux-query\builds\default
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
51
bitrise.yml
Normal file
51
bitrise.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
format_version: '8'
|
||||
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
|
||||
project_type: other
|
||||
trigger_map:
|
||||
- push_branch: "*"
|
||||
workflow: primary
|
||||
- pull_request_source_branch: "*"
|
||||
workflow: primary
|
||||
workflows:
|
||||
primary:
|
||||
steps:
|
||||
- git-clone@4.0.17: {}
|
||||
- brew-install@0.10.2:
|
||||
inputs:
|
||||
- packages: maven
|
||||
- script@1.1.5:
|
||||
title: Install Cocoapods
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo gem install cocoapods
|
||||
- script@1.1.5:
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
mvn package
|
||||
title: Build openapi-generator
|
||||
- script@1.1.5:
|
||||
title: Update Swift4 samples
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sh bin/swift4-all.sh
|
||||
- script@1.1.5:
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
./samples/client/petstore/swift4/swift4_test_all.sh && ./samples/client/test/swift4/swift4_test_all.sh && exit ${PIPESTATUS[0]}
|
||||
title: Run Swift4 tests
|
||||
|
||||
@@ -65,6 +65,7 @@ The following generators are available:
|
||||
* [typescript-inversify](generators/typescript-inversify.md)
|
||||
* [typescript-jquery](generators/typescript-jquery.md)
|
||||
* [typescript-node](generators/typescript-node.md)
|
||||
* [typescript-redux-query](generators/typescript-redux-query.md)
|
||||
* [typescript-rxjs](generators/typescript-rxjs.md)
|
||||
|
||||
|
||||
|
||||
@@ -12,4 +12,5 @@ sidebar_label: go-experimental
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|
||||
@@ -12,4 +12,5 @@ sidebar_label: go
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|
||||
19
docs/generators/typescript-redux-query.md
Normal file
19
docs/generators/typescript-redux-query.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Config Options for typescript-redux-query
|
||||
sidebar_label: typescript-redux-query
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|
||||
@@ -557,3 +557,85 @@ The name of the file should be `config.yml` or `config.yaml` (in our example it
|
||||
openapi-generator generate -i petstore.yaml -g typescript-fetch -o out \
|
||||
-c config.yaml
|
||||
```
|
||||
|
||||
|
||||
## batch
|
||||
|
||||
The `batch` command allows you to move all CLI arguments supported by the `generate` command into a YAML or JSON file.
|
||||
|
||||
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
|
||||
modified by `--includes-base-dir`.
|
||||
|
||||
```bash
|
||||
openapi-generator help batch
|
||||
NAME
|
||||
openapi-generator-cli batch - Generate code in batch via external
|
||||
configs.
|
||||
|
||||
SYNOPSIS
|
||||
openapi-generator-cli batch [--fail-fast]
|
||||
[--includes-base-dir <includes>] [(-r <threads> | --threads <threads>)]
|
||||
[--root-dir <root>] [--timeout <timeout>] [(-v | --verbose)] [--]
|
||||
<configs>...
|
||||
|
||||
OPTIONS
|
||||
--fail-fast
|
||||
fail fast on any errors
|
||||
|
||||
--includes-base-dir <includes>
|
||||
base directory used for includes
|
||||
|
||||
-r <threads>, --threads <threads>
|
||||
thread count
|
||||
|
||||
--root-dir <root>
|
||||
root directory used output/includes (includes can be overridden)
|
||||
|
||||
--timeout <timeout>
|
||||
execution timeout (minutes)
|
||||
|
||||
-v, --verbose
|
||||
verbose mode
|
||||
|
||||
--
|
||||
This option can be used to separate command-line options from the
|
||||
list of argument, (useful when arguments might be mistaken for
|
||||
command-line options
|
||||
|
||||
<configs>
|
||||
Generator configuration files.
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
# create "shared" config
|
||||
mkdir shared && cat > shared/common.yaml <<EOF
|
||||
inputSpec: https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
additionalProperties:
|
||||
x-ext-name: "Your Name"
|
||||
EOF
|
||||
|
||||
# create "standard" configs
|
||||
cat > kotlin.yaml <<EOF
|
||||
'!include': 'shared/common.yaml'
|
||||
outputDir: out/kotlin
|
||||
generatorName: kotlin
|
||||
artifactId: kotlin-petstore-string
|
||||
additionalProperties:
|
||||
dateLibrary: string
|
||||
serializableModel: "true"
|
||||
EOF
|
||||
|
||||
cat > csharp.yaml <<EOF
|
||||
'!include': 'shared/common.yaml'
|
||||
outputDir: out/csharp-netcore
|
||||
generatorName: csharp-netcore
|
||||
additionalProperties:
|
||||
packageGuid: "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
|
||||
useCompareNetObjects: "true"
|
||||
EOF
|
||||
|
||||
# Generate them
|
||||
openapi-generator batch *.yaml
|
||||
```
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
@@ -100,16 +101,6 @@ public class GenerateBatch implements Runnable {
|
||||
numThreads = threads;
|
||||
}
|
||||
|
||||
// This allows us to put meta-configs in a different file from referenced configs.
|
||||
// If not specified, we'll assume it's the parent directory of the first file.
|
||||
File includesDir;
|
||||
if (includes != null) {
|
||||
includesDir = new File(includes);
|
||||
} else {
|
||||
Path first = Paths.get(configs.get(0));
|
||||
includesDir = first.getParent().toFile();
|
||||
}
|
||||
|
||||
Path rootDir;
|
||||
if (root != null) {
|
||||
rootDir = Paths.get(root);
|
||||
@@ -117,7 +108,23 @@ public class GenerateBatch implements Runnable {
|
||||
rootDir = Paths.get(System.getProperty("user.dir"));
|
||||
}
|
||||
|
||||
LOGGER.info(String.format(Locale.ROOT, "Batch generation using %d threads.\nIncludes: %s\nRoot: %s", numThreads, includesDir.getAbsolutePath(), rootDir.toAbsolutePath().toString()));
|
||||
// This allows us to put meta-configs in a different file from referenced configs.
|
||||
// If not specified, we'll assume it's the parent directory of the first file.
|
||||
File includesDir;
|
||||
if (includes != null) {
|
||||
includesDir = new File(includes);
|
||||
} else {
|
||||
Path first = Paths.get(configs.get(0));
|
||||
if (Files.isRegularFile(first) && !Files.isSymbolicLink(first)) {
|
||||
includesDir = first.toAbsolutePath().getParent().toFile();
|
||||
} else {
|
||||
// Not traversing symbolic links for includes. Falling back to rooted working directory.
|
||||
includesDir = rootDir.toFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOGGER.info(String.format(Locale.ROOT, "Batch generation using up to %d threads.\nIncludes: %s\nRoot: %s", numThreads, includesDir.getAbsolutePath(), rootDir.toAbsolutePath().toString()));
|
||||
|
||||
// Create a module which loads our config files, but supports a special "!include" key which can point to an existing config file.
|
||||
// This allows us to create a sort of meta-config which holds configs which are otherwise required at CLI time (via generate task).
|
||||
|
||||
@@ -200,6 +200,7 @@
|
||||
<generex-version>1.0.2</generex-version>
|
||||
<jackson-version>2.9.10</jackson-version>
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
<kotlin-version>1.3.41</kotlin-version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -328,6 +329,24 @@
|
||||
<artifactId>openapi-generator-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler-embeddable</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-util</artifactId>
|
||||
<version>${kotlin-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CodegenModel {
|
||||
.append("hasMoreModels", hasMoreModels)
|
||||
.append("hasEnums", hasEnums)
|
||||
.append("isEnum", isEnum)
|
||||
.append("isNullable", isEnum)
|
||||
.append("isNullable", isNullable)
|
||||
.append("hasRequired", hasRequired)
|
||||
.append("hasOptional", hasOptional)
|
||||
.append("isArrayModel", isArrayModel)
|
||||
|
||||
@@ -135,7 +135,8 @@ public class CodegenConfigurator {
|
||||
|
||||
return configurator;
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Unable to deserialize config file: " + configFile, ex);
|
||||
LOGGER.error(ex.getMessage());
|
||||
throw new RuntimeException("Unable to deserialize config file: " + configFile);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
protected boolean withGoCodegenComment = false;
|
||||
protected boolean withXml = false;
|
||||
protected boolean enumClassPrefix = false;
|
||||
protected boolean structPrefix = false;
|
||||
|
||||
protected String packageName = "openapi";
|
||||
protected Set<String> numberTypes;
|
||||
@@ -113,10 +114,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
typeMapping.put("object", "map[string]interface{}");
|
||||
|
||||
numberTypes = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16","int32", "int64",
|
||||
"float32", "float64")
|
||||
Arrays.asList(
|
||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16", "int32", "int64",
|
||||
"float32", "float64")
|
||||
);
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
@@ -278,10 +279,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
return "[]" + getTypeDeclaration(inner);
|
||||
return "[]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner));
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(p);
|
||||
return getSchemaType(p) + "[string]" + getTypeDeclaration(inner);
|
||||
return getSchemaType(p) + "[string]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner));
|
||||
}
|
||||
//return super.getTypeDeclaration(p);
|
||||
|
||||
@@ -505,7 +506,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
CodegenModel model = (CodegenModel) v;
|
||||
for (CodegenProperty param : model.vars) {
|
||||
if (!addedTimeImport
|
||||
&& ("time.Time".equals(param.dataType) || ("[]time.Time".equals(param.dataType)))) {
|
||||
&& ("time.Time".equals(param.dataType) || ("[]time.Time".equals(param.dataType)))) {
|
||||
imports.add(createMapping("import", "time"));
|
||||
addedTimeImport = true;
|
||||
}
|
||||
@@ -641,6 +642,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
this.enumClassPrefix = enumClassPrefix;
|
||||
}
|
||||
|
||||
public void setStructPrefix(boolean structPrefix) {
|
||||
this.structPrefix = structPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
if (schema.getDefault() != null) {
|
||||
|
||||
@@ -689,7 +689,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
Schema<?> items = getSchemaItems((ArraySchema) p);
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(items) + ">";
|
||||
return getSchemaType(p) + "<" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, items)) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(p);
|
||||
if (inner == null) {
|
||||
@@ -697,7 +697,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
p.setAdditionalProperties(inner);
|
||||
}
|
||||
return getSchemaType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||
return getSchemaType(p) + "<String, " + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + ">";
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
protected boolean isGoSubmodule = false;
|
||||
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
|
||||
public static final String WITH_XML = "withXml";
|
||||
public static final String STRUCT_PREFIX = "structPrefix";
|
||||
|
||||
public GoClientCodegen() {
|
||||
super();
|
||||
@@ -56,6 +57,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs"));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC));
|
||||
cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts"));
|
||||
|
||||
// option to change the order of form/body parameter
|
||||
cliOptions.add(CliOption.newBoolean(
|
||||
@@ -127,6 +129,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(STRUCT_PREFIX)) {
|
||||
setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString()));
|
||||
if (structPrefix) {
|
||||
additionalProperties.put(STRUCT_PREFIX, "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
* Copyright 2018 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class TypeScriptReduxQueryClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||
|
||||
public static final String NPM_REPOSITORY = "npmRepository";
|
||||
public static final String WITH_INTERFACES = "withInterfaces";
|
||||
public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter";
|
||||
|
||||
protected String npmRepository = null;
|
||||
private boolean useSingleRequestParameter = true;
|
||||
protected boolean addedApiIndex = false;
|
||||
protected boolean addedModelIndex = false;
|
||||
|
||||
|
||||
public TypeScriptReduxQueryClientCodegen() {
|
||||
super();
|
||||
|
||||
// clear import mapping (from default generator) as TS does not use it
|
||||
// at the moment
|
||||
importMapping.clear();
|
||||
|
||||
supportsMultipleInheritance = true;
|
||||
|
||||
outputFolder = "generated-code/typescript-redux-query";
|
||||
embeddedTemplateDir = templateDir = "typescript-redux-query";
|
||||
|
||||
this.apiPackage = "src" + File.separator +"apis";
|
||||
this.modelPackage = "src" + File.separator + "models";
|
||||
this.apiTemplateFiles.put("apis.mustache", ".ts");
|
||||
this.modelTemplateFiles.put("models.mustache", ".ts");
|
||||
this.addExtraReservedWords();
|
||||
|
||||
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "typescript-redux-query";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a TypeScript client library using redux-query API (beta).";
|
||||
}
|
||||
|
||||
public String getNpmRepository() {
|
||||
return npmRepository;
|
||||
}
|
||||
|
||||
public void setNpmRepository(String npmRepository) {
|
||||
this.npmRepository = npmRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
additionalProperties.put("isOriginalModelPropertyNaming", getModelPropertyNaming().equals("original"));
|
||||
additionalProperties.put("modelPropertyNaming", getModelPropertyNaming());
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "src", "index.ts"));
|
||||
supportingFiles.add(new SupportingFile("runtime.mustache", "src", "runtime.ts"));
|
||||
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
|
||||
if (additionalProperties.containsKey(USE_SINGLE_REQUEST_PARAMETER)) {
|
||||
this.setUseSingleRequestParameter(convertPropertyToBoolean(USE_SINGLE_REQUEST_PARAMETER));
|
||||
}
|
||||
writePropertyBack(USE_SINGLE_REQUEST_PARAMETER, getUseSingleRequestParameter());
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
addNpmPackageGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
Schema inner;
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
inner = ((ArraySchema) p).getItems();
|
||||
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(inner) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
inner = ModelUtils.getAdditionalProperties(p);
|
||||
return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }";
|
||||
} else if (ModelUtils.isFileSchema(p)) {
|
||||
return "Blob";
|
||||
} else if (ModelUtils.isBinarySchema(p)) {
|
||||
return "Blob";
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
return "Date";
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
return "Date";
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
codegenModel.additionalPropertiesType = getTypeDeclaration(ModelUtils.getAdditionalProperties(schema));
|
||||
addImport(codegenModel, codegenModel.additionalPropertiesType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
List<Object> models = (List<Object>) postProcessModelsEnum(objs).get("models");
|
||||
|
||||
// process enum in models
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
cm.imports = new TreeSet(cm.imports);
|
||||
// name enum with model name, e.g. StatusEnum => Pet.StatusEnum
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
// behaviour for enum names is specific for Typescript Fetch, not using namespaces
|
||||
var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
if (cm.parent != null) {
|
||||
for (CodegenProperty var : cm.allVars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum
|
||||
.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cm.oneOf.isEmpty()) {
|
||||
// For oneOfs only import $refs within the oneOf
|
||||
TreeSet<String> oneOfRefs = new TreeSet<>();
|
||||
for (String im : cm.imports) {
|
||||
if (cm.oneOf.contains(im)) {
|
||||
oneOfRefs.add(im);
|
||||
}
|
||||
}
|
||||
cm.imports = oneOfRefs;
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
Map<String, Object> result = super.postProcessAllModels(objs);
|
||||
for (Map.Entry<String, Object> entry : result.entrySet()) {
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||
for (Map<String, Object> model : models) {
|
||||
CodegenModel codegenModel = (CodegenModel) model.get("model");
|
||||
model.put("hasImports", codegenModel.imports.size() > 0);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addNpmPackageGeneration() {
|
||||
|
||||
if (additionalProperties.containsKey(NPM_REPOSITORY)) {
|
||||
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
|
||||
}
|
||||
|
||||
//Files for building our lib
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
||||
supportingFiles.add(new SupportingFile("npmignore.mustache", "", ".npmignore"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> operations, List<Object> allModels) {
|
||||
// Add supporting file only if we plan to generate files in /apis
|
||||
if (operations.size() > 0 && !addedApiIndex) {
|
||||
addedApiIndex = true;
|
||||
supportingFiles.add(new SupportingFile("apis.index.mustache", apiPackage().replace('.', File.separatorChar), "index.ts"));
|
||||
}
|
||||
|
||||
// Add supporting file only if we plan to generate files in /models
|
||||
if (allModels.size() > 0 && !addedModelIndex) {
|
||||
addedModelIndex = true;
|
||||
supportingFiles.add(new SupportingFile("models.index.mustache", modelPackage().replace('.', File.separatorChar), "index.ts"));
|
||||
}
|
||||
|
||||
this.addOperationModelImportInformation(operations);
|
||||
this.updateOperationParameterEnumInformation(operations);
|
||||
this.addOperationObjectResponseInformation(operations);
|
||||
return operations;
|
||||
}
|
||||
|
||||
private void addOperationModelImportInformation(Map<String, Object> operations) {
|
||||
// This method will add extra information to the operations.imports array.
|
||||
// The api template uses this information to import all the required
|
||||
// models for a given operation.
|
||||
List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
|
||||
for (Map<String, Object> im : imports) {
|
||||
String[] parts = im.get("import").toString().replace(modelPackage() + ".", "").split("( [|&] )|[<>]");
|
||||
for (String s : parts) {
|
||||
if (needToImport(s)) {
|
||||
im.put("filename", im.get("import"));
|
||||
im.put("className", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOperationParameterEnumInformation(Map<String, Object> operations) {
|
||||
// This method will add extra information as to whether or not we have enums and
|
||||
// update their names with the operation.id prefixed.
|
||||
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
|
||||
boolean hasEnum = false;
|
||||
for (CodegenOperation op : operationList) {
|
||||
for (CodegenParameter param : op.allParams) {
|
||||
if (Boolean.TRUE.equals(param.isEnum)) {
|
||||
hasEnum = true;
|
||||
param.datatypeWithEnum = param.datatypeWithEnum
|
||||
.replace(param.enumName, op.operationIdCamelCase + param.enumName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
operations.put("hasEnums", hasEnum);
|
||||
}
|
||||
|
||||
private void addOperationObjectResponseInformation(Map<String, Object> operations) {
|
||||
// This method will modify the information on the operations' return type.
|
||||
// The api template uses this information to know when to return a text
|
||||
// response for a given simple response operation.
|
||||
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
if(op.returnType == "object") {
|
||||
op.isMapContainer = true;
|
||||
op.returnSimpleType = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addExtraReservedWords() {
|
||||
this.reservedWords.add("BASE_PATH");
|
||||
this.reservedWords.add("BaseAPI");
|
||||
this.reservedWords.add("RequiredError");
|
||||
this.reservedWords.add("COLLECTION_FORMATS");
|
||||
// this.reservedWords.add("FetchAPI");
|
||||
this.reservedWords.add("ConfigurationParameters");
|
||||
this.reservedWords.add("Configuration");
|
||||
this.reservedWords.add("configuration");
|
||||
this.reservedWords.add("HTTPMethod");
|
||||
this.reservedWords.add("HTTPHeaders");
|
||||
this.reservedWords.add("HTTPQuery");
|
||||
this.reservedWords.add("HTTPBody");
|
||||
this.reservedWords.add("ModelPropertyNaming");
|
||||
// this.reservedWords.add("FetchParams");
|
||||
this.reservedWords.add("RequestOpts");
|
||||
this.reservedWords.add("exists");
|
||||
this.reservedWords.add("RequestContext");
|
||||
this.reservedWords.add("ResponseContext");
|
||||
this.reservedWords.add("Middleware");
|
||||
this.reservedWords.add("ApiResponse");
|
||||
this.reservedWords.add("ResponseTransformer");
|
||||
this.reservedWords.add("JSONApiResponse");
|
||||
this.reservedWords.add("VoidApiResponse");
|
||||
this.reservedWords.add("BlobApiResponse");
|
||||
this.reservedWords.add("TextApiResponse");
|
||||
}
|
||||
|
||||
private boolean getUseSingleRequestParameter() {
|
||||
return useSingleRequestParameter;
|
||||
}
|
||||
|
||||
private void setUseSingleRequestParameter(boolean useSingleRequestParameter) {
|
||||
this.useSingleRequestParameter = useSingleRequestParameter;
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,7 @@ org.openapitools.codegen.languages.TypeScriptFetchClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptInversifyClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptJqueryClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
|
||||
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
|
||||
org.openapitools.codegen.languages.FsharpGiraffeServerCodegen
|
||||
org.openapitools.codegen.languages.AsciidocDocumentationCodegen
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:keywords: openapi, rest, {{appName}}
|
||||
:specDir: {{specDir}}
|
||||
:snippetDir: {{snippetDir}}
|
||||
:generator-template: v1 2019-11-10
|
||||
:generator-template: v1 2019-11-19
|
||||
:info-url: {{infoUrl}}
|
||||
:app-name: {{appName}}
|
||||
|
||||
@@ -18,6 +18,20 @@
|
||||
|
||||
{{#specinclude}}intro.adoc{{/specinclude}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
== Access
|
||||
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
{{^isBasicBearer}}* *HTTP Basic* Authentication _{{{name}}}_{{/isBasicBearer}}
|
||||
{{#isBasicBearer}}* *Bearer* Authentication {{/isBasicBearer}}
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}* *OAuth* AuthorizationUrl: _{{authorizationUrl}}_, TokenUrl: _{{tokenUrl}}_ {{/isOAuth}}
|
||||
{{#isApiKey}}* *APIKey* KeyParamName: _{{keyParamName}}_, KeyInQuery: _{{isKeyInQuery}}_, KeyInHeader: _{{isKeyInHeader}}_{{/isApiKey}}
|
||||
{{/authMethods}}
|
||||
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
== Endpoints
|
||||
|
||||
{{#apiInfo}}
|
||||
|
||||
@@ -26,6 +26,19 @@
|
||||
|===
|
||||
{{/hasBodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
===== Form Parameter
|
||||
|
||||
[cols="2,3,1,1,1"]
|
||||
|===
|
||||
|Name| Description| Required| Default| Pattern
|
||||
|
||||
{{#formParams}}
|
||||
{{>param}}
|
||||
{{/formParams}}
|
||||
|===
|
||||
{{/hasFormParams}}
|
||||
|
||||
{{#hasHeaderParams}}
|
||||
====== Header Parameters
|
||||
|
||||
|
||||
@@ -31,8 +31,10 @@ public:
|
||||
{{#operations}}{{#operation}}void {{nickname}}({{#allParams}}const {{{dataType}}}& {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}{{/operations}}
|
||||
private:
|
||||
QString _scheme, _host, _basePath;
|
||||
int _port, _timeOut;
|
||||
QString _scheme, _host;
|
||||
int _port;
|
||||
QString _basePath;
|
||||
int _timeOut;
|
||||
QString _workingDirectory;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
{{#operations}}{{#operation}}void {{nickname}}Callback ({{prefix}}HttpRequestWorker * worker);
|
||||
|
||||
@@ -21,8 +21,8 @@ type {{classname}}Service service
|
||||
{{#operation}}
|
||||
|
||||
{{#hasOptionalParams}}
|
||||
// {{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}'
|
||||
type {{{nickname}}}Opts struct {
|
||||
// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}'
|
||||
type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct {
|
||||
{{#allParams}}
|
||||
{{^required}}
|
||||
{{#isPrimitiveType}}
|
||||
@@ -53,7 +53,7 @@ type {{{nickname}}}Opts struct {
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#hasOptionalParams}}
|
||||
* @param optional nil or *{{{nickname}}}Opts - Optional Parameters:
|
||||
* @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters:
|
||||
{{#allParams}}
|
||||
{{^required}}
|
||||
* @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}}
|
||||
@@ -64,7 +64,7 @@ type {{{nickname}}}Opts struct {
|
||||
@return {{{returnType}}}
|
||||
{{/returnType}}
|
||||
*/
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.Method{{httpMethod}}
|
||||
localVarPostBody interface{}
|
||||
|
||||
@@ -21,8 +21,8 @@ type {{classname}}Service service
|
||||
{{#operation}}
|
||||
|
||||
{{#hasOptionalParams}}
|
||||
// {{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}'
|
||||
type {{{nickname}}}Opts struct {
|
||||
// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}'
|
||||
type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct {
|
||||
{{#allParams}}
|
||||
{{^required}}
|
||||
{{#isPrimitiveType}}
|
||||
@@ -53,7 +53,7 @@ type {{{nickname}}}Opts struct {
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#hasOptionalParams}}
|
||||
* @param optional nil or *{{{nickname}}}Opts - Optional Parameters:
|
||||
* @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters:
|
||||
{{#allParams}}
|
||||
{{^required}}
|
||||
* @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}}
|
||||
@@ -64,7 +64,7 @@ type {{{nickname}}}Opts struct {
|
||||
@return {{{returnType}}}
|
||||
{{/returnType}}
|
||||
*/
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.Method{{httpMethod}}
|
||||
localVarPostBody interface{}
|
||||
|
||||
@@ -31,6 +31,19 @@ use {{modelPackage}}\ModelInterface;
|
||||
*/
|
||||
class ObjectSerializer
|
||||
{
|
||||
/** @var string */
|
||||
private static $dateTimeFormat = \DateTime::ATOM;
|
||||
|
||||
/**
|
||||
* Change the date format
|
||||
*
|
||||
* @param string $format the new date format to use
|
||||
*/
|
||||
public static function setDateTimeFormat($format)
|
||||
{
|
||||
self::$dateTimeFormat = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data
|
||||
*
|
||||
@@ -45,7 +58,7 @@ class ObjectSerializer
|
||||
if (is_scalar($data) || null === $data) {
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
|
||||
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
@@ -178,7 +191,7 @@ class ObjectSerializer
|
||||
public static function toString($value)
|
||||
{
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ATOM);
|
||||
return $value->format(self::$dateTimeFormat);
|
||||
} else if (is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// tslint:disable
|
||||
// eslint-disable
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
{{>licenseInfo}}
|
||||
|
||||
import * as runtime from '../runtime';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// tslint:disable
|
||||
// eslint-disable
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
{{>licenseInfo}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// tslint:disable
|
||||
// eslint-disable
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
{{>licenseInfo}}
|
||||
|
||||
export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
|
||||
|
||||
33
modules/openapi-generator/src/main/resources/typescript-redux-query/README.mustache
vendored
Normal file
33
modules/openapi-generator/src/main/resources/typescript-redux-query/README.mustache
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
## {{npmName}}@{{npmVersion}}
|
||||
|
||||
This generator creates TypeScript/JavaScript client that utilizes [redux-query](https://amplitude.github.io/redux-query/).
|
||||
The generated Node module does not depend on ReactJS specifically.
|
||||
|
||||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
||||
|
||||
### Building
|
||||
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Publishing
|
||||
|
||||
First build the package then run ```npm publish```
|
||||
|
||||
### Consuming
|
||||
|
||||
navigate to the folder of your consuming project and run one of the following commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install {{npmName}}@{{npmVersion}} --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
7
modules/openapi-generator/src/main/resources/typescript-redux-query/apis.index.mustache
vendored
Normal file
7
modules/openapi-generator/src/main/resources/typescript-redux-query/apis.index.mustache
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
export * from './{{ classFilename }}';
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
260
modules/openapi-generator/src/main/resources/typescript-redux-query/apis.mustache
vendored
Normal file
260
modules/openapi-generator/src/main/resources/typescript-redux-query/apis.mustache
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
// tslint:disable
|
||||
{{>licenseInfo}}
|
||||
|
||||
import { HttpMethods, QueryConfig, ResponseBody, ResponseText } from 'redux-query';
|
||||
import * as runtime from '../runtime';
|
||||
|
||||
{{#imports.0}}
|
||||
import {
|
||||
{{#imports}}
|
||||
{{className}},
|
||||
{{className}}FromJSON,
|
||||
{{className}}ToJSON,
|
||||
{{/imports}}
|
||||
} from '../models';
|
||||
{{/imports.0}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#allParams.0}}
|
||||
export interface {{operationIdCamelCase}}Request {
|
||||
{{#allParams}}
|
||||
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}};
|
||||
{{/allParams}}
|
||||
}
|
||||
|
||||
{{/allParams.0}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{#operations}}
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
{{#notes}}
|
||||
* {{¬es}}
|
||||
{{/notes}}
|
||||
{{#summary}}
|
||||
* {{&summary}}
|
||||
{{/summary}}
|
||||
*/
|
||||
function {{nickname}}Raw<T>({{#allParams.0}}requestParameters: {{operationIdCamelCase}}Request,{{/allParams.0}} requestConfig: runtime.TypedQueryConfig<T, {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> = {}): QueryConfig<T> {
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) {
|
||||
throw new runtime.RequiredError('{{paramName}}','Required parameter requestParameters.{{paramName}} was null or undefined when calling {{nickname}}.');
|
||||
}
|
||||
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
let queryParameters = null;
|
||||
|
||||
{{#queryParams.0}}
|
||||
queryParameters = {};
|
||||
{{/queryParams.0}}
|
||||
|
||||
{{#queryParams}}
|
||||
|
||||
{{#isListContainer}}
|
||||
if (requestParameters.{{paramName}}) {
|
||||
{{#isCollectionFormatMulti}}
|
||||
queryParameters['{{baseName}}'] = requestParameters.{{paramName}};
|
||||
{{/isCollectionFormatMulti}}
|
||||
{{^isCollectionFormatMulti}}
|
||||
queryParameters['{{baseName}}'] = requestParameters.{{paramName}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
|
||||
{{/isCollectionFormatMulti}}
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
if (requestParameters.{{paramName}} !== undefined) {
|
||||
{{#isDateTime}}
|
||||
queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString();
|
||||
{{/isDateTime}}
|
||||
{{^isDateTime}}
|
||||
{{#isDate}}
|
||||
queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString().substr(0,10);
|
||||
{{/isDate}}
|
||||
{{^isDate}}
|
||||
queryParameters['{{baseName}}'] = requestParameters.{{paramName}};
|
||||
{{/isDate}}
|
||||
{{/isDateTime}}
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{/queryParams}}
|
||||
const headerParameters = {};
|
||||
|
||||
{{#bodyParam}}
|
||||
{{^consumes}}
|
||||
headerParameters['Content-Type'] = 'application/json';
|
||||
|
||||
{{/consumes}}
|
||||
{{#consumes.0}}
|
||||
headerParameters['Content-Type'] = '{{{mediaType}}}';
|
||||
|
||||
{{/consumes.0}}
|
||||
{{/bodyParam}}
|
||||
{{#headerParams}}
|
||||
{{#isListContainer}}
|
||||
if (requestParameters.{{paramName}}) {
|
||||
headerParameters['{{baseName}}'] = requestParameters.{{paramName}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
if (requestParameters.{{paramName}} !== undefined && requestParameters.{{paramName}} !== null) {
|
||||
headerParameters['{{baseName}}'] = String(requestParameters.{{paramName}});
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{/headerParams}}
|
||||
|
||||
const { meta = {} } = requestConfig;
|
||||
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
meta.authType = ['basic'];
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
meta.authType = ['bearer'];
|
||||
{{/isBasicBearer}}
|
||||
{{/isBasic}}
|
||||
{{#isApiKey}}
|
||||
{{#isKeyInHeader}}
|
||||
meta.authType = ['api_key', 'header'];
|
||||
{{/isKeyInHeader}}
|
||||
{{#isKeyInQuery}}
|
||||
meta.authType = ['api_key', 'query'];
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
meta.authType = ['oauth', [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]];
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{#hasFormParams}}
|
||||
const formData = new FormData();
|
||||
{{/hasFormParams}}
|
||||
{{#formParams}}
|
||||
{{#isListContainer}}
|
||||
if (requestParameters.{{paramName}}) {
|
||||
{{#isCollectionFormatMulti}}
|
||||
requestParameters.{{paramName}}.forEach((element) => {
|
||||
formData.append('{{baseName}}', element as any);
|
||||
})
|
||||
{{/isCollectionFormatMulti}}
|
||||
{{^isCollectionFormatMulti}}
|
||||
formData.append('{{baseName}}', requestParameters.{{paramName}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]));
|
||||
{{/isCollectionFormatMulti}}
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
if (requestParameters.{{paramName}} !== undefined) {
|
||||
formData.append('{{baseName}}', requestParameters.{{paramName}} as any);
|
||||
}
|
||||
|
||||
{{/isListContainer}}
|
||||
{{/formParams}}
|
||||
const config: QueryConfig<T> = {
|
||||
url: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}},
|
||||
meta,
|
||||
update: requestConfig.update,
|
||||
queryKey: requestConfig.queryKey,
|
||||
optimisticUpdate: requestConfig.optimisticUpdate,
|
||||
force: requestConfig.force,
|
||||
rollback: requestConfig.rollback,
|
||||
options: {
|
||||
method: '{{httpMethod}}',
|
||||
headers: headerParameters,
|
||||
},
|
||||
{{#hasBodyParam}}
|
||||
{{#bodyParam}}
|
||||
{{#isContainer}}
|
||||
body: queryParameters || requestParameters.{{paramName}}{{#isListContainer}}{{#items}}{{^isPrimitiveType}}.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isListContainer}},
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{^isPrimitiveType}}
|
||||
body: queryParameters || {{dataType}}ToJSON(requestParameters.{{paramName}}),
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
body: queryParameters || requestParameters.{{paramName}} as any,
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/bodyParam}}
|
||||
{{/hasBodyParam}}
|
||||
{{^hasBodyParam}}
|
||||
{{#hasFormParams}}
|
||||
body: formData,
|
||||
{{/hasFormParams}}
|
||||
{{^hasFormParams}}
|
||||
body: queryParameters,
|
||||
{{/hasFormParams}}
|
||||
{{/hasBodyParam}}
|
||||
};
|
||||
|
||||
const { transform: requestTransform } = requestConfig;
|
||||
if (requestTransform) {
|
||||
{{#returnType}}
|
||||
{{#returnTypeIsPrimitive}}
|
||||
{{#returnSimpleType}}
|
||||
throw "OH NO";
|
||||
{{/returnSimpleType}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{^returnTypeIsPrimitive}}
|
||||
{{#isListContainer}}
|
||||
config.transform = (body: ResponseBody, text: ResponseBody) => requestTransform(body.map({{returnBaseType}}FromJSON), text);
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
config.transform = (body: ResponseBody, text: ResponseBody) => requestTransform({{returnBaseType}}FromJSON(body), text);
|
||||
{{/isListContainer}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{/returnType}}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
{{#notes}}
|
||||
* {{¬es}}
|
||||
{{/notes}}
|
||||
{{#summary}}
|
||||
* {{&summary}}
|
||||
{{/summary}}
|
||||
*/
|
||||
{{^useSingleRequestParameter}}
|
||||
export function {{nickname}}<T>({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}requestConfig?: runtime.TypedQueryConfig<T, {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>): QueryConfig<T> {
|
||||
return {{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}} }, {{/allParams.0}} requestConfig);
|
||||
}
|
||||
{{/useSingleRequestParameter}}
|
||||
{{#useSingleRequestParameter}}
|
||||
export function {{nickname}}<T>({{#allParams.0}}requestParameters: {{operationIdCamelCase}}Request,{{/allParams.0}} requestConfig?: runtime.TypedQueryConfig<T, {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>): QueryConfig<T> {
|
||||
return {{nickname}}Raw({{#allParams.0}}requestParameters,{{/allParams.0}} requestConfig);
|
||||
}
|
||||
{{/useSingleRequestParameter}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{#hasEnums}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#allParams}}
|
||||
{{#isEnum}}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum {{operationIdCamelCase}}{{enumName}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/allParams}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/hasEnums}}
|
||||
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
9
modules/openapi-generator/src/main/resources/typescript-redux-query/index.mustache
vendored
Normal file
9
modules/openapi-generator/src/main/resources/typescript-redux-query/index.mustache
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export * from './runtime';
|
||||
{{#apiInfo}}
|
||||
{{#apis.0}}
|
||||
export * from './apis';
|
||||
{{/apis.0}}
|
||||
{{/apiInfo}}
|
||||
{{#models.0}}
|
||||
export * from './models';
|
||||
{{/models.0}}
|
||||
11
modules/openapi-generator/src/main/resources/typescript-redux-query/licenseInfo.mustache
vendored
Normal file
11
modules/openapi-generator/src/main/resources/typescript-redux-query/licenseInfo.mustache
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* {{{appName}}}
|
||||
* {{{appDescription}}}
|
||||
*
|
||||
* {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}}
|
||||
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
20
modules/openapi-generator/src/main/resources/typescript-redux-query/modelEnum.mustache
vendored
Normal file
20
modules/openapi-generator/src/main/resources/typescript-redux-query/modelEnum.mustache
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* {{{description}}}
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
|
||||
export function {{classname}}FromJSON(json: any): {{classname}} {
|
||||
return json as {{classname}};
|
||||
}
|
||||
|
||||
export function {{classname}}ToJSON(value?: {{classname}}): any {
|
||||
return value as any;
|
||||
}
|
||||
141
modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache
vendored
Normal file
141
modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
import { exists, mapValues } from '../runtime';
|
||||
{{#hasImports}}
|
||||
import {
|
||||
{{#imports}}
|
||||
{{{.}}},
|
||||
{{.}}FromJSON,
|
||||
{{.}}ToJSON,
|
||||
{{/imports}}
|
||||
} from './';
|
||||
|
||||
{{/hasImports}}
|
||||
/**
|
||||
* {{{description}}}
|
||||
* @export
|
||||
* @interface {{classname}}
|
||||
*/
|
||||
export interface {{classname}} {{#allParents.0}}extends{{#allParents}} {{{.}}}{{^-last}},{{/-last}}{{/allParents}}{{/allParents.0}} {
|
||||
{{#additionalPropertiesType}}
|
||||
[key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}};
|
||||
{{/additionalPropertiesType}}
|
||||
{{#vars}}
|
||||
/**
|
||||
* {{{description}}}
|
||||
* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>
|
||||
* @memberof {{classname}}
|
||||
*/
|
||||
{{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
export function {{classname}}FromJSON(json: any): {{classname}} {
|
||||
{{#hasVars}}
|
||||
return {
|
||||
{{#allParents}}
|
||||
...{{.}}FromJSON(json),
|
||||
{{/allParents}}
|
||||
{{#additionalPropertiesType}}
|
||||
...json,
|
||||
{{/additionalPropertiesType}}
|
||||
{{#vars}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isDate}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}new Date(json['{{baseName}}']),
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}new Date(json['{{baseName}}']),
|
||||
{{/isDateTime}}
|
||||
{{^isDate}}
|
||||
{{^isDateTime}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}json['{{baseName}}'],
|
||||
{{/isDateTime}}
|
||||
{{/isDate}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isListContainer}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}(json['{{baseName}}'] as Array<any>).map({{#items}}{{datatype}}{{/items}}FromJSON),
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}mapValues(json['{{baseName}}'], {{#items}}{{datatype}}{{/items}}FromJSON),
|
||||
{{/isMapContainer}}
|
||||
{{^isListContainer}}
|
||||
{{^isMapContainer}}
|
||||
{{^isFreeFormObject}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}{{datatype}}FromJSON(json['{{baseName}}']),
|
||||
{{/isFreeFormObject}}
|
||||
{{#isFreeFormObject}}
|
||||
'{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}json['{{baseName}}'],
|
||||
{{/isFreeFormObject}}
|
||||
{{/isMapContainer}}
|
||||
{{/isListContainer}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
};
|
||||
{{/hasVars}}
|
||||
{{^hasVars}}
|
||||
return json;
|
||||
{{/hasVars}}
|
||||
}
|
||||
|
||||
export function {{classname}}ToJSON(value?: {{classname}}): any {
|
||||
{{#hasVars}}
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
{{#allParents}}
|
||||
...{{.}}ToJSON(value),
|
||||
{{/allParents}}
|
||||
{{#additionalPropertiesType}}
|
||||
...value,
|
||||
{{/additionalPropertiesType}}
|
||||
{{#vars}}
|
||||
{{^isReadOnly}}
|
||||
{{#isPrimitiveType}}
|
||||
'{{baseName}}': {{#isDate}}{{^required}}value.{{name}} === undefined ? undefined : {{/required}}value.{{name}}.toISOString().substr(0,10){{/isDate}}{{#isDateTime}}{{^required}}value.{{name}} === undefined ? undefined : {{/required}}value.{{name}}.toISOString(){{/isDateTime}}{{^isDate}}{{^isDateTime}}value.{{name}}{{/isDateTime}}{{/isDate}},
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isListContainer}}
|
||||
'{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}(value.{{name}} as Array<any>).map({{#items}}{{datatype}}{{/items}}ToJSON),
|
||||
{{/isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
'{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}mapValues(value.{{name}}, {{#items}}{{datatype}}{{/items}}ToJSON),
|
||||
{{/isMapContainer}}
|
||||
{{^isListContainer}}
|
||||
{{^isMapContainer}}
|
||||
{{^isFreeFormObject}}
|
||||
'{{baseName}}': {{datatype}}ToJSON(value.{{name}}),
|
||||
{{/isFreeFormObject}}
|
||||
{{#isFreeFormObject}}
|
||||
'{{baseName}}': value.{{name}},
|
||||
{{/isFreeFormObject}}
|
||||
{{/isMapContainer}}
|
||||
{{/isListContainer}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isReadOnly}}
|
||||
{{/vars}}
|
||||
};
|
||||
{{/hasVars}}
|
||||
{{^hasVars}}
|
||||
return value;
|
||||
{{/hasVars}}
|
||||
}
|
||||
|
||||
{{#hasEnums}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum {{classname}}{{enumName}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
|
||||
{{/hasEnums}}
|
||||
46
modules/openapi-generator/src/main/resources/typescript-redux-query/modelOneOf.mustache
vendored
Normal file
46
modules/openapi-generator/src/main/resources/typescript-redux-query/modelOneOf.mustache
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{{#hasImports}}
|
||||
import {
|
||||
{{#imports}}
|
||||
{{{.}}},
|
||||
{{{.}}}FromJSON,
|
||||
{{{.}}}ToJSON,
|
||||
{{/imports}}
|
||||
} from './';
|
||||
|
||||
{{/hasImports}}
|
||||
/**
|
||||
* @type {{classname}}{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @export
|
||||
*/
|
||||
export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}};
|
||||
|
||||
{{#discriminator}}
|
||||
|
||||
export function {{classname}}FromJSON(json: any): {{classname}} {
|
||||
switch (json.{{propertyName}}) {
|
||||
{{#mappedModels}}
|
||||
case '{{mappingName}}': return {{modelName}}FromJSON(json);
|
||||
{{/mappedModels}}
|
||||
default: throw new Error("Unexpected {{propertyName}} value.");
|
||||
}
|
||||
}
|
||||
|
||||
export function {{classname}}ToJSON(value?: {{classname}}): any {
|
||||
{{#hasVars}}
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
switch (value.{{propertyName}}) {
|
||||
{{#mappedModels}}
|
||||
case '{{mappingName}}': return {{modelName}}ToJSON(value);
|
||||
{{/mappedModels}}
|
||||
default: throw new Error("Unexpected {{propertyName}} value.");
|
||||
}
|
||||
{{/hasVars}}
|
||||
{{^hasVars}}
|
||||
return value;
|
||||
{{/hasVars}}
|
||||
}
|
||||
{{/discriminator}}
|
||||
5
modules/openapi-generator/src/main/resources/typescript-redux-query/models.index.mustache
vendored
Normal file
5
modules/openapi-generator/src/main/resources/typescript-redux-query/models.index.mustache
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
export * from './{{{ classFilename }}}';
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
19
modules/openapi-generator/src/main/resources/typescript-redux-query/models.mustache
vendored
Normal file
19
modules/openapi-generator/src/main/resources/typescript-redux-query/models.mustache
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// tslint:disable
|
||||
{{>licenseInfo}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
{{>modelEnum}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#oneOf}}
|
||||
{{#-first}}
|
||||
{{>modelOneOf}}
|
||||
{{/-first}}
|
||||
{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
{{>modelGeneric}}
|
||||
{{/oneOf}}
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
1
modules/openapi-generator/src/main/resources/typescript-redux-query/npmignore.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/typescript-redux-query/npmignore.mustache
vendored
Normal file
@@ -0,0 +1 @@
|
||||
README.md
|
||||
23
modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache
vendored
Normal file
23
modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "{{npmName}}",
|
||||
"version": "{{npmVersion}}",
|
||||
"description": "OpenAPI client for {{npmName}}",
|
||||
"author": "OpenAPI-Generator",
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts" : {
|
||||
"build": "tsc",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"redux-query": "^3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^3.0"
|
||||
}{{#npmRepository}},{{/npmRepository}}
|
||||
{{#npmRepository}}
|
||||
"publishConfig": {
|
||||
"registry": "{{npmRepository}}"
|
||||
}
|
||||
{{/npmRepository}}
|
||||
}
|
||||
46
modules/openapi-generator/src/main/resources/typescript-redux-query/runtime.mustache
vendored
Normal file
46
modules/openapi-generator/src/main/resources/typescript-redux-query/runtime.mustache
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// tslint:disable
|
||||
{{>licenseInfo}}
|
||||
|
||||
import { Meta, OptimisticUpdate, QueryKey, QueryOptions, Rollback, TransformStrategy, Update } from "redux-query";
|
||||
|
||||
export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
|
||||
|
||||
export interface TypedQueryConfig<TState, TBody> {
|
||||
force?: boolean;
|
||||
meta?: Meta;
|
||||
options?: QueryOptions;
|
||||
queryKey?: QueryKey;
|
||||
update?: Update<TState>;
|
||||
optimisticUpdate?: OptimisticUpdate<TState>;
|
||||
retry?: boolean;
|
||||
rollback?: Rollback<TState>;
|
||||
transform?: TransformStrategy<TState, TBody>
|
||||
}
|
||||
|
||||
export class RequiredError extends Error {
|
||||
name: "RequiredError" = "RequiredError";
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
|
||||
|
||||
export function exists(json: any, key: string) {
|
||||
const value = json[key];
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export function mapValues(data: any, fn: (item: any) => any) {
|
||||
return Object.keys(data).reduce(
|
||||
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
|
||||
{}
|
||||
);
|
||||
}
|
||||
22
modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache
vendored
Normal file
22
modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist",
|
||||
{{^supportsES6}}
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
{{/supportsES6}}
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -115,4 +115,26 @@ public class AsciidocSampleGeneratorTest {
|
||||
"keep parameter name from-iso-date-string unchanged.");
|
||||
}
|
||||
|
||||
/**
|
||||
* added apikey info in access section.
|
||||
*/
|
||||
@Test
|
||||
public void testSampleAsciidocMarkupGenerationAccessApiKey() throws Exception {
|
||||
Assert.assertTrue(markupContent.contains("*APIKey*"),
|
||||
"access section mit apikey expected.");
|
||||
Assert.assertFalse(markupContent.contains("*OAuth*"),
|
||||
"access section no oauth expected.");
|
||||
Assert.assertFalse(markupContent.contains("*HTTP Basic*"),
|
||||
"access section no http basic expected.");
|
||||
}
|
||||
|
||||
/**
|
||||
* no form params in this sample spec.
|
||||
*/
|
||||
@Test
|
||||
public void testSampleAsciidocMarkupGenerationWithoutFormParameter() throws Exception {
|
||||
Assert.assertFalse(markupContent.contains("= Form Parameter"),
|
||||
"no form parameters in this openapi spec expected.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,17 @@
|
||||
|
||||
package org.openapitools.codegen.go;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.IntegerSchema;
|
||||
import io.swagger.v3.oas.models.media.MapSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.java.AbstractJavaCodegenTest;
|
||||
import org.openapitools.codegen.languages.AbstractGoCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -54,6 +62,37 @@ public class AbstractGoCodegenTest {
|
||||
Assert.assertEquals(codegen.isHideGenerationTimestamp(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTypeDeclarationTest() {
|
||||
final AbstractGoCodegen codegen = new P_AbstractGoCodegen();
|
||||
|
||||
// Create an alias to an array schema
|
||||
Schema<?> nestedArraySchema = new ArraySchema().items(new IntegerSchema().format("int32"));
|
||||
codegen.setOpenAPI(new OpenAPI().components(new Components().addSchemas("NestedArray", nestedArraySchema)));
|
||||
|
||||
// Create an array schema with item type set to the array alias
|
||||
Schema<?> schema = new ArraySchema().items(new Schema().$ref("#/components/schemas/NestedArray"));
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(false);
|
||||
String defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "[][]int32");
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "[]NestedArray");
|
||||
|
||||
// Create a map schema with additionalProperties type set to array alias
|
||||
schema = new MapSchema().additionalProperties(new Schema().$ref("#/components/schemas/NestedArray"));
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(false);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "map[string][]int32");
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "map[string]NestedArray");
|
||||
}
|
||||
|
||||
private static class P_AbstractGoCodegen extends AbstractGoCodegen {
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
|
||||
@@ -56,6 +56,8 @@ public class GoClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setIsGoSubmodule(Boolean.valueOf(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setStructPrefix(Boolean.valueOf(GoClientOptionsProvider.STRUCT_PREFIX_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
|
||||
package org.openapitools.codegen.java;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.IntegerSchema;
|
||||
import io.swagger.v3.oas.models.media.ObjectSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.TestUtils;
|
||||
import org.openapitools.codegen.languages.AbstractJavaCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -420,6 +420,32 @@ public class AbstractJavaCodegenTest {
|
||||
Schema<?> schema = createObjectSchemaWithMinItems();
|
||||
String defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "Object");
|
||||
|
||||
// Create an alias to an array schema
|
||||
Schema<?> nestedArraySchema = new ArraySchema().items(new IntegerSchema().format("int32"));
|
||||
codegen.setOpenAPI(new OpenAPI().components(new Components().addSchemas("NestedArray", nestedArraySchema)));
|
||||
|
||||
// Create an array schema with item type set to the array alias
|
||||
schema = new ArraySchema().items(new Schema().$ref("#/components/schemas/NestedArray"));
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(false);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "List<List<Integer>>");
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "List<NestedArray>");
|
||||
|
||||
// Create a map schema with additionalProperties type set to array alias
|
||||
schema = new MapSchema().additionalProperties(new Schema().$ref("#/components/schemas/NestedArray"));
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(false);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "Map<String, List<Integer>>");
|
||||
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
defaultValue = codegen.getTypeDeclaration(schema);
|
||||
Assert.assertEquals(defaultValue, "Map<String, NestedArray>");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.openapitools.codegen.kotlin;
|
||||
|
||||
import kotlin.script.experimental.jvm.util.KotlinJars;
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys;
|
||||
import org.jetbrains.kotlin.cli.common.config.ContentRootsKt;
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer;
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.Disposable;
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
|
||||
import org.jetbrains.kotlin.config.JvmTarget;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
|
||||
import static kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classpathFromClassloader;
|
||||
|
||||
public class KotlinTestUtils {
|
||||
|
||||
public static ClassLoader buildModule(List<String> sourcePath, ClassLoader classLoader) {
|
||||
|
||||
String moduleName = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
File saveClassesDir;
|
||||
try {
|
||||
saveClassesDir = Files.createTempDirectory("kotlin" + moduleName).toFile();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
compileModule(moduleName, sourcePath, saveClassesDir, classLoader, true);
|
||||
|
||||
try {
|
||||
return new URLClassLoader(new URL[]{saveClassesDir.toURI().toURL()}, classLoader);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static GenerationState compileModule(String moduleName, List<String> sourcePath, File saveClassesDir, ClassLoader classLoader, boolean forcedAddKotlinStd) {
|
||||
Disposable stubDisposable = new StubDisposable();
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, moduleName);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = null;
|
||||
try {
|
||||
ps = new PrintStream(baos, true, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new PrintingMessageCollector(ps, MessageRenderer.PLAIN_FULL_PATHS, true));
|
||||
configuration.put(JVMConfigurationKeys.OUTPUT_DIRECTORY, saveClassesDir);
|
||||
// configuration.put(JVMConfigurationKeys.RETAIN_OUTPUT_IN_MEMORY, true)
|
||||
configuration.put(JVMConfigurationKeys.JVM_TARGET, JvmTarget.JVM_1_8);
|
||||
Set<File> classPath = new HashSet<>();
|
||||
if (classLoader != null) {
|
||||
classPath.addAll(classpathFromClassloader(classLoader, false));
|
||||
}
|
||||
if (forcedAddKotlinStd) {
|
||||
classPath.add(KotlinJars.INSTANCE.getStdlib());
|
||||
}
|
||||
JvmContentRootsKt.addJvmClasspathRoots(configuration, new ArrayList<>(classPath));
|
||||
ContentRootsKt.addKotlinSourceRoots(configuration, sourcePath);
|
||||
|
||||
KotlinCoreEnvironment env = KotlinCoreEnvironment.createForProduction(stubDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
GenerationState result = KotlinToJVMBytecodeCompiler.INSTANCE.analyzeAndGenerate(env);
|
||||
ps.flush();
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else {
|
||||
String s;
|
||||
try {
|
||||
s = new String(baos.toByteArray(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
throw new IllegalStateException("Compilation error. Details:\n" + s);
|
||||
}
|
||||
}
|
||||
|
||||
static class StubDisposable implements Disposable {
|
||||
|
||||
volatile boolean isDisposed = false;
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return isDisposed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.openapitools.codegen.kotlin;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Collections;
|
||||
|
||||
public class KotlinTestUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testNormalCompile() throws Exception {
|
||||
ClassLoader classLoader = KotlinTestUtils.buildModule(Collections.singletonList(getClass().getResource("KotlinTestUtilsTest/normalPack").getFile()), Thread.currentThread().getContextClassLoader());
|
||||
Class<?> clazz = classLoader.loadClass("com.example.SimpleClass");
|
||||
Constructor<?>[] constructors = clazz.getConstructors();
|
||||
Assert.assertEquals(1, constructors.length);
|
||||
Constructor<?> constr = constructors[0];
|
||||
Object testObj = constr.newInstance("test");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = Exception.class)
|
||||
public void testBadCompile() {
|
||||
KotlinTestUtils.buildModule(Collections.singletonList(getClass().getResource("KotlinTestUtilsTest/badPack").getFile()), Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
|
||||
public static final boolean ENUM_CLASS_PREFIX_VALUE = true;
|
||||
public static final Boolean PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true;
|
||||
public static final boolean IS_GO_SUBMODULE_VALUE = true;
|
||||
public static final boolean STRUCT_PREFIX_VALUE = true;
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
@@ -49,6 +50,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
|
||||
.put(CodegenConstants.ENUM_CLASS_PREFIX, "true")
|
||||
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true")
|
||||
.put(CodegenConstants.IS_GO_SUBMODULE, "true")
|
||||
.put("structPrefix", "true")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.example
|
||||
|
||||
|
||||
class SimpleClass {
|
||||
fun void testFun(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example
|
||||
|
||||
class SimpleClass (val someStr:String) {
|
||||
fun testFun(str: String) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
4.2.0-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
||||
@@ -41,6 +41,7 @@ $(tput setaf 3)PETSTORE_HOST$(tput sgr0) - server URL, e.g. https://example.com:
|
||||
$(tput setaf 3)PETSTORE_API_KEY$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\
|
||||
$(tput setaf 3)PETSTORE_API_KEY$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\
|
||||
$(tput setaf 3)PETSTORE_BASIC_AUTH$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\
|
||||
$(tput setaf 3)PETSTORE_BASIC_AUTH$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\
|
||||
\n\
|
||||
$(tput setaf 7)Basic usage:$(tput sgr0)\n\
|
||||
\n\
|
||||
|
||||
@@ -101,7 +101,8 @@ All URIs are relative to */v2*
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AnotherFakeApi* | [**call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
||||
*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem
|
||||
*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
|
||||
*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
|
||||
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
|
||||
@@ -144,16 +145,8 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [$special[modelName]](docs/$special[modelName].md)
|
||||
- [200Response](docs/200Response.md)
|
||||
- [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
|
||||
- [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
|
||||
- [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
|
||||
- [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
|
||||
- [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
|
||||
- [AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [ApiResponse](docs/ApiResponse.md)
|
||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
@@ -171,23 +164,34 @@ Class | Method | HTTP request | Description
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||
- [Foo](docs/Foo.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [HealthCheckResult](docs/HealthCheckResult.md)
|
||||
- [InlineObject](docs/InlineObject.md)
|
||||
- [InlineObject1](docs/InlineObject1.md)
|
||||
- [InlineObject2](docs/InlineObject2.md)
|
||||
- [InlineObject3](docs/InlineObject3.md)
|
||||
- [InlineObject4](docs/InlineObject4.md)
|
||||
- [InlineObject5](docs/InlineObject5.md)
|
||||
- [InlineResponseDefault](docs/InlineResponseDefault.md)
|
||||
- [MapTest](docs/MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Name](docs/Name.md)
|
||||
- [NullableClass](docs/NullableClass.md)
|
||||
- [NumberOnly](docs/NumberOnly.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
|
||||
- [OuterEnumInteger](docs/OuterEnumInteger.md)
|
||||
- [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [Return](docs/Return.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TypeHolderDefault](docs/TypeHolderDefault.md)
|
||||
- [TypeHolderExample](docs/TypeHolderExample.md)
|
||||
- [User](docs/User.md)
|
||||
- [XmlItem](docs/XmlItem.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
@@ -207,6 +211,10 @@ Class | Method | HTTP request | Description
|
||||
- **API key parameter name**: api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
## bearer_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
@@ -296,7 +296,7 @@ case $state in
|
||||
ops)
|
||||
# Operations
|
||||
_values "Operations" \
|
||||
"call123TestSpecialTags[To test special tags]" "createXmlItem[creates an XmlItem]" \
|
||||
"call123TestSpecialTags[To test special tags]" "fooGet[]" "fakeHealthGet[Health check endpoint]" \
|
||||
"fakeOuterBooleanSerialize[]" \
|
||||
"fakeOuterCompositeSerialize[]" \
|
||||
"fakeOuterNumberSerialize[]" \
|
||||
@@ -343,7 +343,13 @@ case $state in
|
||||
)
|
||||
_describe -t actions 'operations' _op_arguments -S '' && ret=0
|
||||
;;
|
||||
createXmlItem)
|
||||
fooGet)
|
||||
local -a _op_arguments
|
||||
_op_arguments=(
|
||||
)
|
||||
_describe -t actions 'operations' _op_arguments -S '' && ret=0
|
||||
;;
|
||||
fakeHealthGet)
|
||||
local -a _op_arguments
|
||||
_op_arguments=(
|
||||
)
|
||||
|
||||
@@ -3,17 +3,8 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**mapUnderscorestring** | **map[String, string]** | | [optional] [default to null]
|
||||
**mapUnderscorenumber** | **map[String, integer]** | | [optional] [default to null]
|
||||
**mapUnderscoreinteger** | **map[String, integer]** | | [optional] [default to null]
|
||||
**mapUnderscoreboolean** | **map[String, boolean]** | | [optional] [default to null]
|
||||
**mapUnderscorearrayUnderscoreinteger** | **map[String, array[integer]]** | | [optional] [default to null]
|
||||
**mapUnderscorearrayUnderscoreanytype** | **map[String, array[map]]** | | [optional] [default to null]
|
||||
**mapUnderscoremapUnderscorestring** | **map[String, map[String, string]]** | | [optional] [default to null]
|
||||
**mapUnderscoremapUnderscoreanytype** | **map[String, map[String, map]]** | | [optional] [default to null]
|
||||
**anytypeUnderscore1** | [**map**](.md) | | [optional] [default to null]
|
||||
**anytypeUnderscore2** | [**map**](.md) | | [optional] [default to null]
|
||||
**anytypeUnderscore3** | [**map**](.md) | | [optional] [default to null]
|
||||
**mapUnderscoreproperty** | **map[String, string]** | | [optional] [default to null]
|
||||
**mapUnderscoreofUnderscoremapUnderscoreproperty** | **map[String, map[String, string]]** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ petstore-cli call123TestSpecialTags
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md) | client model |
|
||||
**client** | [**Client**](Client.md) | client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
### Example
|
||||
|
||||
```bash
|
||||
fooGet
|
||||
petstore-cli fooGet
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
@@ -8,6 +8,9 @@ Name | Type | Description | Notes
|
||||
**enumUnderscoreinteger** | **integer** | | [optional] [default to null]
|
||||
**enumUnderscorenumber** | **float** | | [optional] [default to null]
|
||||
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null]
|
||||
**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] [default to null]
|
||||
**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to null]
|
||||
**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ All URIs are relative to */v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem
|
||||
[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint
|
||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
@@ -24,28 +24,23 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
|
||||
## createXmlItem
|
||||
## fakeHealthGet
|
||||
|
||||
creates an XmlItem
|
||||
|
||||
this route creates an XmlItem
|
||||
Health check endpoint
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
petstore-cli createXmlItem
|
||||
petstore-cli fakeHealthGet
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**xmlItem** | [**XmlItem**](XmlItem.md) | XmlItem Body |
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
[**HealthCheckResult**](HealthCheckResult.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -53,8 +48,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
|
||||
- **Accept**: Not Applicable
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -88,7 +83,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -111,7 +106,7 @@ petstore-cli fakeOuterCompositeSerialize
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | [optional]
|
||||
**outerComposite** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -123,7 +118,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -158,7 +153,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -193,7 +188,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -216,7 +211,7 @@ petstore-cli testBodyWithFileSchema
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | |
|
||||
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -250,7 +245,7 @@ petstore-cli testBodyWithQueryParams query=value
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query** | **string** | | [default to null]
|
||||
**body** | [**User**](User.md) | |
|
||||
**user** | [**User**](User.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -285,7 +280,7 @@ petstore-cli testClientModel
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md) | client model |
|
||||
**client** | [**Client**](Client.md) | client model |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -366,7 +361,7 @@ To test enum parameters
|
||||
### Example
|
||||
|
||||
```bash
|
||||
petstore-cli testEnumParameters enum_header_string_array:value enum_header_string:value Specify as: enum_query_string_array="value1,value2,..." enum_query_string=value enum_query_integer=value enum_query_double=value
|
||||
petstore-cli testEnumParameters enum_header_string_array:value enum_header_string:value Specify as: enum_query_string_array=value1 enum_query_string_array=value2 enum_query_string_array=... enum_query_string=value enum_query_integer=value enum_query_double=value
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@@ -429,7 +424,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[bearer_test](../README.md#bearer_test)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@@ -454,7 +449,7 @@ petstore-cli testInlineAdditionalProperties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**param** | [**map[String, string]**](string.md) | request body |
|
||||
**requestBody** | [**map[String, string]**](string.md) | request body |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -515,7 +510,7 @@ To test the collection format in query parameters
|
||||
### Example
|
||||
|
||||
```bash
|
||||
petstore-cli testQueryParameterCollectionFormat Specify as: pipe="value1,value2,..." Specify as: ioutil="value1,value2,..." Specify as: Specify as: url="value1,value2,..." Specify as: context=value1 context=value2 context=...
|
||||
petstore-cli testQueryParameterCollectionFormat Specify as: pipe=value1 pipe=value2 pipe=... Specify as: ioutil="value1,value2,..." Specify as: Specify as: url="value1,value2,..." Specify as: context=value1 context=value2 context=...
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
@@ -25,7 +25,7 @@ petstore-cli testClassname
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md) | client model |
|
||||
**client** | [**Client**](Client.md) | client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ Name | Type | Description | Notes
|
||||
**dateTime** | **string** | | [optional] [default to null]
|
||||
**uuid** | **string** | | [optional] [default to null]
|
||||
**password** | **string** | | [default to null]
|
||||
**BigDecimal** | [**BigDecimal**](BigDecimal.md) | | [optional] [default to null]
|
||||
**patternUnderscorewithUnderscoredigits** | **string** | | [optional] [default to null]
|
||||
**patternUnderscorewithUnderscoredigitsUnderscoreandUnderscoredelimiter** | **string** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ petstore-cli addPet
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -203,7 +203,7 @@ petstore-cli updatePet
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ petstore-cli placeOrder
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md) | order placed for purchasing the pet |
|
||||
**order** | [**Order**](Order.md) | order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -140,7 +140,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -32,7 +32,7 @@ petstore-cli createUser
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md) | Created user object |
|
||||
**user** | [**User**](User.md) | Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -44,7 +44,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not Applicable
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -65,7 +65,7 @@ petstore-cli createUsersWithArrayInput
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**array[User]**](User.md) | List of user object |
|
||||
**user** | [**array[User]**](User.md) | List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -77,7 +77,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not Applicable
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -98,7 +98,7 @@ petstore-cli createUsersWithListInput
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**array[User]**](User.md) | List of user object |
|
||||
**user** | [**array[User]**](User.md) | List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -110,7 +110,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not Applicable
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
@@ -266,7 +266,7 @@ petstore-cli updateUser username=value
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **string** | name that need to be deleted | [default to null]
|
||||
**body** | [**User**](User.md) | Updated user object |
|
||||
**user** | [**User**](User.md) | Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -278,7 +278,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not Applicable
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not Applicable
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# !
|
||||
# ! Note:
|
||||
@@ -9,6 +10,7 @@
|
||||
# !
|
||||
# !
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
#
|
||||
# This is a Bash client for OpenAPI Petstore.
|
||||
#
|
||||
@@ -93,16 +95,15 @@ declare -a result_color_table=( "$WHITE" "$WHITE" "$GREEN" "$YELLOW" "$WHITE" "$
|
||||
# 0 - optional
|
||||
# 1 - required
|
||||
declare -A operation_parameters_minimum_occurrences
|
||||
operation_parameters_minimum_occurrences["call123TestSpecialTags:::body"]=1
|
||||
operation_parameters_minimum_occurrences["createXmlItem:::XmlItem"]=1
|
||||
operation_parameters_minimum_occurrences["call123TestSpecialTags:::Client"]=1
|
||||
operation_parameters_minimum_occurrences["fakeOuterBooleanSerialize:::body"]=0
|
||||
operation_parameters_minimum_occurrences["fakeOuterCompositeSerialize:::body"]=0
|
||||
operation_parameters_minimum_occurrences["fakeOuterCompositeSerialize:::OuterComposite"]=0
|
||||
operation_parameters_minimum_occurrences["fakeOuterNumberSerialize:::body"]=0
|
||||
operation_parameters_minimum_occurrences["fakeOuterStringSerialize:::body"]=0
|
||||
operation_parameters_minimum_occurrences["testBodyWithFileSchema:::body"]=1
|
||||
operation_parameters_minimum_occurrences["testBodyWithFileSchema:::FileSchemaTestClass"]=1
|
||||
operation_parameters_minimum_occurrences["testBodyWithQueryParams:::query"]=1
|
||||
operation_parameters_minimum_occurrences["testBodyWithQueryParams:::body"]=1
|
||||
operation_parameters_minimum_occurrences["testClientModel:::body"]=1
|
||||
operation_parameters_minimum_occurrences["testBodyWithQueryParams:::User"]=1
|
||||
operation_parameters_minimum_occurrences["testClientModel:::Client"]=1
|
||||
operation_parameters_minimum_occurrences["testEndpointParameters:::number"]=1
|
||||
operation_parameters_minimum_occurrences["testEndpointParameters:::double"]=1
|
||||
operation_parameters_minimum_occurrences["testEndpointParameters:::pattern_without_delimiter"]=1
|
||||
@@ -131,7 +132,7 @@ operation_parameters_minimum_occurrences["testGroupParameters:::required_int64_g
|
||||
operation_parameters_minimum_occurrences["testGroupParameters:::string_group"]=0
|
||||
operation_parameters_minimum_occurrences["testGroupParameters:::boolean_group"]=0
|
||||
operation_parameters_minimum_occurrences["testGroupParameters:::int64_group"]=0
|
||||
operation_parameters_minimum_occurrences["testInlineAdditionalProperties:::param"]=1
|
||||
operation_parameters_minimum_occurrences["testInlineAdditionalProperties:::request_body"]=1
|
||||
operation_parameters_minimum_occurrences["testJsonFormData:::param"]=1
|
||||
operation_parameters_minimum_occurrences["testJsonFormData:::param2"]=1
|
||||
operation_parameters_minimum_occurrences["testQueryParameterCollectionFormat:::pipe"]=1
|
||||
@@ -139,14 +140,14 @@ operation_parameters_minimum_occurrences["testQueryParameterCollectionFormat:::i
|
||||
operation_parameters_minimum_occurrences["testQueryParameterCollectionFormat:::http"]=1
|
||||
operation_parameters_minimum_occurrences["testQueryParameterCollectionFormat:::url"]=1
|
||||
operation_parameters_minimum_occurrences["testQueryParameterCollectionFormat:::context"]=1
|
||||
operation_parameters_minimum_occurrences["testClassname:::body"]=1
|
||||
operation_parameters_minimum_occurrences["addPet:::body"]=1
|
||||
operation_parameters_minimum_occurrences["testClassname:::Client"]=1
|
||||
operation_parameters_minimum_occurrences["addPet:::Pet"]=1
|
||||
operation_parameters_minimum_occurrences["deletePet:::petId"]=1
|
||||
operation_parameters_minimum_occurrences["deletePet:::api_key"]=0
|
||||
operation_parameters_minimum_occurrences["findPetsByStatus:::status"]=1
|
||||
operation_parameters_minimum_occurrences["findPetsByTags:::tags"]=1
|
||||
operation_parameters_minimum_occurrences["getPetById:::petId"]=1
|
||||
operation_parameters_minimum_occurrences["updatePet:::body"]=1
|
||||
operation_parameters_minimum_occurrences["updatePet:::Pet"]=1
|
||||
operation_parameters_minimum_occurrences["updatePetWithForm:::petId"]=1
|
||||
operation_parameters_minimum_occurrences["updatePetWithForm:::name"]=0
|
||||
operation_parameters_minimum_occurrences["updatePetWithForm:::status"]=0
|
||||
@@ -158,16 +159,16 @@ operation_parameters_minimum_occurrences["uploadFileWithRequiredFile:::requiredF
|
||||
operation_parameters_minimum_occurrences["uploadFileWithRequiredFile:::additionalMetadata"]=0
|
||||
operation_parameters_minimum_occurrences["deleteOrder:::order_id"]=1
|
||||
operation_parameters_minimum_occurrences["getOrderById:::order_id"]=1
|
||||
operation_parameters_minimum_occurrences["placeOrder:::body"]=1
|
||||
operation_parameters_minimum_occurrences["createUser:::body"]=1
|
||||
operation_parameters_minimum_occurrences["createUsersWithArrayInput:::body"]=1
|
||||
operation_parameters_minimum_occurrences["createUsersWithListInput:::body"]=1
|
||||
operation_parameters_minimum_occurrences["placeOrder:::Order"]=1
|
||||
operation_parameters_minimum_occurrences["createUser:::User"]=1
|
||||
operation_parameters_minimum_occurrences["createUsersWithArrayInput:::User"]=1
|
||||
operation_parameters_minimum_occurrences["createUsersWithListInput:::User"]=1
|
||||
operation_parameters_minimum_occurrences["deleteUser:::username"]=1
|
||||
operation_parameters_minimum_occurrences["getUserByName:::username"]=1
|
||||
operation_parameters_minimum_occurrences["loginUser:::username"]=1
|
||||
operation_parameters_minimum_occurrences["loginUser:::password"]=1
|
||||
operation_parameters_minimum_occurrences["updateUser:::username"]=1
|
||||
operation_parameters_minimum_occurrences["updateUser:::body"]=1
|
||||
operation_parameters_minimum_occurrences["updateUser:::User"]=1
|
||||
|
||||
##
|
||||
# This array stores the maximum number of allowed occurrences for parameter
|
||||
@@ -176,16 +177,15 @@ operation_parameters_minimum_occurrences["updateUser:::body"]=1
|
||||
# N - N values
|
||||
# 0 - unlimited
|
||||
declare -A operation_parameters_maximum_occurrences
|
||||
operation_parameters_maximum_occurrences["call123TestSpecialTags:::body"]=0
|
||||
operation_parameters_maximum_occurrences["createXmlItem:::XmlItem"]=0
|
||||
operation_parameters_maximum_occurrences["call123TestSpecialTags:::Client"]=0
|
||||
operation_parameters_maximum_occurrences["fakeOuterBooleanSerialize:::body"]=0
|
||||
operation_parameters_maximum_occurrences["fakeOuterCompositeSerialize:::body"]=0
|
||||
operation_parameters_maximum_occurrences["fakeOuterCompositeSerialize:::OuterComposite"]=0
|
||||
operation_parameters_maximum_occurrences["fakeOuterNumberSerialize:::body"]=0
|
||||
operation_parameters_maximum_occurrences["fakeOuterStringSerialize:::body"]=0
|
||||
operation_parameters_maximum_occurrences["testBodyWithFileSchema:::body"]=0
|
||||
operation_parameters_maximum_occurrences["testBodyWithFileSchema:::FileSchemaTestClass"]=0
|
||||
operation_parameters_maximum_occurrences["testBodyWithQueryParams:::query"]=0
|
||||
operation_parameters_maximum_occurrences["testBodyWithQueryParams:::body"]=0
|
||||
operation_parameters_maximum_occurrences["testClientModel:::body"]=0
|
||||
operation_parameters_maximum_occurrences["testBodyWithQueryParams:::User"]=0
|
||||
operation_parameters_maximum_occurrences["testClientModel:::Client"]=0
|
||||
operation_parameters_maximum_occurrences["testEndpointParameters:::number"]=0
|
||||
operation_parameters_maximum_occurrences["testEndpointParameters:::double"]=0
|
||||
operation_parameters_maximum_occurrences["testEndpointParameters:::pattern_without_delimiter"]=0
|
||||
@@ -214,7 +214,7 @@ operation_parameters_maximum_occurrences["testGroupParameters:::required_int64_g
|
||||
operation_parameters_maximum_occurrences["testGroupParameters:::string_group"]=0
|
||||
operation_parameters_maximum_occurrences["testGroupParameters:::boolean_group"]=0
|
||||
operation_parameters_maximum_occurrences["testGroupParameters:::int64_group"]=0
|
||||
operation_parameters_maximum_occurrences["testInlineAdditionalProperties:::param"]=0
|
||||
operation_parameters_maximum_occurrences["testInlineAdditionalProperties:::request_body"]=0
|
||||
operation_parameters_maximum_occurrences["testJsonFormData:::param"]=0
|
||||
operation_parameters_maximum_occurrences["testJsonFormData:::param2"]=0
|
||||
operation_parameters_maximum_occurrences["testQueryParameterCollectionFormat:::pipe"]=0
|
||||
@@ -222,14 +222,14 @@ operation_parameters_maximum_occurrences["testQueryParameterCollectionFormat:::i
|
||||
operation_parameters_maximum_occurrences["testQueryParameterCollectionFormat:::http"]=0
|
||||
operation_parameters_maximum_occurrences["testQueryParameterCollectionFormat:::url"]=0
|
||||
operation_parameters_maximum_occurrences["testQueryParameterCollectionFormat:::context"]=0
|
||||
operation_parameters_maximum_occurrences["testClassname:::body"]=0
|
||||
operation_parameters_maximum_occurrences["addPet:::body"]=0
|
||||
operation_parameters_maximum_occurrences["testClassname:::Client"]=0
|
||||
operation_parameters_maximum_occurrences["addPet:::Pet"]=0
|
||||
operation_parameters_maximum_occurrences["deletePet:::petId"]=0
|
||||
operation_parameters_maximum_occurrences["deletePet:::api_key"]=0
|
||||
operation_parameters_maximum_occurrences["findPetsByStatus:::status"]=0
|
||||
operation_parameters_maximum_occurrences["findPetsByTags:::tags"]=0
|
||||
operation_parameters_maximum_occurrences["getPetById:::petId"]=0
|
||||
operation_parameters_maximum_occurrences["updatePet:::body"]=0
|
||||
operation_parameters_maximum_occurrences["updatePet:::Pet"]=0
|
||||
operation_parameters_maximum_occurrences["updatePetWithForm:::petId"]=0
|
||||
operation_parameters_maximum_occurrences["updatePetWithForm:::name"]=0
|
||||
operation_parameters_maximum_occurrences["updatePetWithForm:::status"]=0
|
||||
@@ -241,31 +241,30 @@ operation_parameters_maximum_occurrences["uploadFileWithRequiredFile:::requiredF
|
||||
operation_parameters_maximum_occurrences["uploadFileWithRequiredFile:::additionalMetadata"]=0
|
||||
operation_parameters_maximum_occurrences["deleteOrder:::order_id"]=0
|
||||
operation_parameters_maximum_occurrences["getOrderById:::order_id"]=0
|
||||
operation_parameters_maximum_occurrences["placeOrder:::body"]=0
|
||||
operation_parameters_maximum_occurrences["createUser:::body"]=0
|
||||
operation_parameters_maximum_occurrences["createUsersWithArrayInput:::body"]=0
|
||||
operation_parameters_maximum_occurrences["createUsersWithListInput:::body"]=0
|
||||
operation_parameters_maximum_occurrences["placeOrder:::Order"]=0
|
||||
operation_parameters_maximum_occurrences["createUser:::User"]=0
|
||||
operation_parameters_maximum_occurrences["createUsersWithArrayInput:::User"]=0
|
||||
operation_parameters_maximum_occurrences["createUsersWithListInput:::User"]=0
|
||||
operation_parameters_maximum_occurrences["deleteUser:::username"]=0
|
||||
operation_parameters_maximum_occurrences["getUserByName:::username"]=0
|
||||
operation_parameters_maximum_occurrences["loginUser:::username"]=0
|
||||
operation_parameters_maximum_occurrences["loginUser:::password"]=0
|
||||
operation_parameters_maximum_occurrences["updateUser:::username"]=0
|
||||
operation_parameters_maximum_occurrences["updateUser:::body"]=0
|
||||
operation_parameters_maximum_occurrences["updateUser:::User"]=0
|
||||
|
||||
##
|
||||
# The type of collection for specifying multiple values for parameter:
|
||||
# - multi, csv, ssv, tsv
|
||||
declare -A operation_parameters_collection_type
|
||||
operation_parameters_collection_type["call123TestSpecialTags:::body"]=""
|
||||
operation_parameters_collection_type["createXmlItem:::XmlItem"]=""
|
||||
operation_parameters_collection_type["call123TestSpecialTags:::Client"]=""
|
||||
operation_parameters_collection_type["fakeOuterBooleanSerialize:::body"]=""
|
||||
operation_parameters_collection_type["fakeOuterCompositeSerialize:::body"]=""
|
||||
operation_parameters_collection_type["fakeOuterCompositeSerialize:::OuterComposite"]=""
|
||||
operation_parameters_collection_type["fakeOuterNumberSerialize:::body"]=""
|
||||
operation_parameters_collection_type["fakeOuterStringSerialize:::body"]=""
|
||||
operation_parameters_collection_type["testBodyWithFileSchema:::body"]=""
|
||||
operation_parameters_collection_type["testBodyWithFileSchema:::FileSchemaTestClass"]=""
|
||||
operation_parameters_collection_type["testBodyWithQueryParams:::query"]=""
|
||||
operation_parameters_collection_type["testBodyWithQueryParams:::body"]=""
|
||||
operation_parameters_collection_type["testClientModel:::body"]=""
|
||||
operation_parameters_collection_type["testBodyWithQueryParams:::User"]=""
|
||||
operation_parameters_collection_type["testClientModel:::Client"]=""
|
||||
operation_parameters_collection_type["testEndpointParameters:::number"]=""
|
||||
operation_parameters_collection_type["testEndpointParameters:::double"]=""
|
||||
operation_parameters_collection_type["testEndpointParameters:::pattern_without_delimiter"]=""
|
||||
@@ -282,7 +281,7 @@ operation_parameters_collection_type["testEndpointParameters:::password"]=""
|
||||
operation_parameters_collection_type["testEndpointParameters:::callback"]=""
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_header_string_array"]="csv"
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_header_string"]=""
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_query_string_array"]="csv"
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_query_string_array"]="multi"
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_query_string"]=""
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_query_integer"]=""
|
||||
operation_parameters_collection_type["testEnumParameters:::enum_query_double"]=""
|
||||
@@ -294,22 +293,22 @@ operation_parameters_collection_type["testGroupParameters:::required_int64_group
|
||||
operation_parameters_collection_type["testGroupParameters:::string_group"]=""
|
||||
operation_parameters_collection_type["testGroupParameters:::boolean_group"]=""
|
||||
operation_parameters_collection_type["testGroupParameters:::int64_group"]=""
|
||||
operation_parameters_collection_type["testInlineAdditionalProperties:::param"]=
|
||||
operation_parameters_collection_type["testInlineAdditionalProperties:::request_body"]=
|
||||
operation_parameters_collection_type["testJsonFormData:::param"]=""
|
||||
operation_parameters_collection_type["testJsonFormData:::param2"]=""
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::pipe"]="csv"
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::pipe"]="multi"
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::ioutil"]="csv"
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::http"]=
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::url"]="csv"
|
||||
operation_parameters_collection_type["testQueryParameterCollectionFormat:::context"]="multi"
|
||||
operation_parameters_collection_type["testClassname:::body"]=""
|
||||
operation_parameters_collection_type["addPet:::body"]=""
|
||||
operation_parameters_collection_type["testClassname:::Client"]=""
|
||||
operation_parameters_collection_type["addPet:::Pet"]=""
|
||||
operation_parameters_collection_type["deletePet:::petId"]=""
|
||||
operation_parameters_collection_type["deletePet:::api_key"]=""
|
||||
operation_parameters_collection_type["findPetsByStatus:::status"]="csv"
|
||||
operation_parameters_collection_type["findPetsByTags:::tags"]="csv"
|
||||
operation_parameters_collection_type["getPetById:::petId"]=""
|
||||
operation_parameters_collection_type["updatePet:::body"]=""
|
||||
operation_parameters_collection_type["updatePet:::Pet"]=""
|
||||
operation_parameters_collection_type["updatePetWithForm:::petId"]=""
|
||||
operation_parameters_collection_type["updatePetWithForm:::name"]=""
|
||||
operation_parameters_collection_type["updatePetWithForm:::status"]=""
|
||||
@@ -321,16 +320,16 @@ operation_parameters_collection_type["uploadFileWithRequiredFile:::requiredFile"
|
||||
operation_parameters_collection_type["uploadFileWithRequiredFile:::additionalMetadata"]=""
|
||||
operation_parameters_collection_type["deleteOrder:::order_id"]=""
|
||||
operation_parameters_collection_type["getOrderById:::order_id"]=""
|
||||
operation_parameters_collection_type["placeOrder:::body"]=""
|
||||
operation_parameters_collection_type["createUser:::body"]=""
|
||||
operation_parameters_collection_type["createUsersWithArrayInput:::body"]=
|
||||
operation_parameters_collection_type["createUsersWithListInput:::body"]=
|
||||
operation_parameters_collection_type["placeOrder:::Order"]=""
|
||||
operation_parameters_collection_type["createUser:::User"]=""
|
||||
operation_parameters_collection_type["createUsersWithArrayInput:::User"]=
|
||||
operation_parameters_collection_type["createUsersWithListInput:::User"]=
|
||||
operation_parameters_collection_type["deleteUser:::username"]=""
|
||||
operation_parameters_collection_type["getUserByName:::username"]=""
|
||||
operation_parameters_collection_type["loginUser:::username"]=""
|
||||
operation_parameters_collection_type["loginUser:::password"]=""
|
||||
operation_parameters_collection_type["updateUser:::username"]=""
|
||||
operation_parameters_collection_type["updateUser:::body"]=""
|
||||
operation_parameters_collection_type["updateUser:::User"]=""
|
||||
|
||||
|
||||
##
|
||||
@@ -723,6 +722,8 @@ EOF
|
||||
echo -e " or export ${RED}PETSTORE_API_KEY='<api-key>'${OFF}"
|
||||
echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u <username>:<password>' before ${YELLOW}<operation>${OFF}"
|
||||
echo -e " or export ${RED}PETSTORE_BASIC_AUTH='<username>:<password>'${OFF}"
|
||||
echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u <username>:<password>' before ${YELLOW}<operation>${OFF}"
|
||||
echo -e " or export ${RED}PETSTORE_BASIC_AUTH='<username>:<password>'${OFF}"
|
||||
echo -e " - ${MAGENTA}OAuth2 (flow: implicit)${OFF}"
|
||||
echo -e " Authorization URL: "
|
||||
echo -e " * http://petstore.swagger.io/api/oauth/dialog"
|
||||
@@ -736,11 +737,17 @@ EOF
|
||||
read -r -d '' ops <<EOF
|
||||
${CYAN}call123TestSpecialTags${OFF};To test special tags
|
||||
EOF
|
||||
echo " $ops" | column -t -s ';'
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}[default]${OFF}"
|
||||
read -r -d '' ops <<EOF
|
||||
${CYAN}fooGet${OFF};
|
||||
EOF
|
||||
echo " $ops" | column -t -s ';'
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}[fake]${OFF}"
|
||||
read -r -d '' ops <<EOF
|
||||
${CYAN}createXmlItem${OFF};creates an XmlItem
|
||||
${CYAN}fakeHealthGet${OFF};Health check endpoint
|
||||
${CYAN}fakeOuterBooleanSerialize${OFF};
|
||||
${CYAN}fakeOuterCompositeSerialize${OFF};
|
||||
${CYAN}fakeOuterNumberSerialize${OFF};
|
||||
@@ -753,7 +760,7 @@ read -r -d '' ops <<EOF
|
||||
偽のエンドポイント
|
||||
가짜 엔드 포인트 (AUTH)
|
||||
${CYAN}testEnumParameters${OFF};To test enum parameters
|
||||
${CYAN}testGroupParameters${OFF};Fake endpoint to test group parameters (optional)
|
||||
${CYAN}testGroupParameters${OFF};Fake endpoint to test group parameters (optional) (AUTH)
|
||||
${CYAN}testInlineAdditionalProperties${OFF};test inline additionalProperties
|
||||
${CYAN}testJsonFormData${OFF};test json serialization of form data
|
||||
${CYAN}testQueryParameterCollectionFormat${OFF};
|
||||
@@ -873,22 +880,31 @@ print_call123TestSpecialTags_help() {
|
||||
}
|
||||
##############################################################################
|
||||
#
|
||||
# Print help for createXmlItem operation
|
||||
# Print help for fooGet operation
|
||||
#
|
||||
##############################################################################
|
||||
print_createXmlItem_help() {
|
||||
print_fooGet_help() {
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}createXmlItem - creates an XmlItem${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e "${BOLD}${WHITE}fooGet - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo -e "this route creates an XmlItem" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/xml,application/xml; charset=utf-8,application/xml; charset=utf-16,text/xml,text/xml; charset=utf-8,text/xml; charset=utf-16]${OFF} ${RED}(required)${OFF}${OFF} - XmlItem Body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
code=0
|
||||
echo -e "${result_color_table[${code:0:1}]} 0;response${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
}
|
||||
##############################################################################
|
||||
#
|
||||
# Print help for fakeHealthGet operation
|
||||
#
|
||||
##############################################################################
|
||||
print_fakeHealthGet_help() {
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}fakeHealthGet - Health check endpoint${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
code=200
|
||||
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e "${result_color_table[${code:0:1}]} 200;The instance started successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
}
|
||||
##############################################################################
|
||||
#
|
||||
@@ -902,7 +918,7 @@ print_fakeOuterBooleanSerialize_help() {
|
||||
echo -e "Test serialization of outer boolean types" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF}${OFF} - Input boolean as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input boolean as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -921,7 +937,7 @@ print_fakeOuterCompositeSerialize_help() {
|
||||
echo -e "Test serialization of object with outer number type" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF}${OFF} - Input composite as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input composite as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -940,7 +956,7 @@ print_fakeOuterNumberSerialize_help() {
|
||||
echo -e "Test serialization of outer number types" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF}${OFF} - Input number as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input number as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -959,7 +975,7 @@ print_fakeOuterStringSerialize_help() {
|
||||
echo -e "Test serialization of outer string types" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF}${OFF} - Input string as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input string as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1062,7 +1078,7 @@ print_testEnumParameters_help() {
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}enum_header_string_array${OFF} ${BLUE}[array[string]]${OFF} ${CYAN}(default: null)${OFF} - Header parameter enum test (string array) ${YELLOW}Specify as: enum_header_string_array:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}enum_header_string${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: -efg)${OFF} - Header parameter enum test (string) ${YELLOW}Specify as: enum_header_string:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}enum_query_string_array${OFF} ${BLUE}[array[string]]${OFF} ${CYAN}(default: null)${OFF} - Query parameter enum test (string array)${YELLOW} Specify as: enum_query_string_array="value1,value2,..."${OFF}" \
|
||||
echo -e " * ${GREEN}enum_query_string_array${OFF} ${BLUE}[array[string]]${OFF} ${CYAN}(default: null)${OFF} - Query parameter enum test (string array)${YELLOW} Specify as: enum_query_string_array=value1 enum_query_string_array=value2 enum_query_string_array=...${OFF}" \
|
||||
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}enum_query_string${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: -efg)${OFF} - Query parameter enum test (string)${YELLOW} Specify as: enum_query_string=value${OFF}" \
|
||||
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
@@ -1084,7 +1100,7 @@ print_testEnumParameters_help() {
|
||||
##############################################################################
|
||||
print_testGroupParameters_help() {
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}testGroupParameters - Fake endpoint to test group parameters (optional)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e "${BOLD}${WHITE}testGroupParameters - Fake endpoint to test group parameters (optional)${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo -e "Fake endpoint to test group parameters (optional)" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
@@ -1148,7 +1164,7 @@ print_testQueryParameterCollectionFormat_help() {
|
||||
echo -e "To test the collection format in query parameters" | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}pipe${OFF} ${BLUE}[array[string]]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW} Specify as: pipe="value1,value2,..."${OFF}" \
|
||||
echo -e " * ${GREEN}pipe${OFF} ${BLUE}[array[string]]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW} Specify as: pipe=value1 pipe=value2 pipe=...${OFF}" \
|
||||
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}ioutil${OFF} ${BLUE}[array[string]]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW} Specify as: ioutil="value1,value2,..."${OFF}" \
|
||||
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
@@ -1196,8 +1212,6 @@ print_addPet_help() {
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
code=200
|
||||
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
code=405
|
||||
echo -e "${result_color_table[${code:0:1}]} 405;Invalid input${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
}
|
||||
@@ -1215,8 +1229,6 @@ print_deletePet_help() {
|
||||
echo -e " * ${GREEN}api_key${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW}Specify as: api_key:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
code=200
|
||||
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
code=400
|
||||
echo -e "${result_color_table[${code:0:1}]} 400;Invalid pet value${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
}
|
||||
@@ -1298,8 +1310,6 @@ print_updatePet_help() {
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
code=200
|
||||
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
code=400
|
||||
echo -e "${result_color_table[${code:0:1}]} 400;Invalid ID supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
code=404
|
||||
@@ -1423,7 +1433,7 @@ print_placeOrder_help() {
|
||||
echo -e "${BOLD}${WHITE}placeOrder - Place an order for a pet${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF} ${RED}(required)${OFF}${OFF} - order placed for purchasing the pet" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - order placed for purchasing the pet" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1444,7 +1454,7 @@ print_createUser_help() {
|
||||
echo -e "This can only be done by the logged in user." | paste -sd' ' | fold -sw 80
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF} ${RED}(required)${OFF}${OFF} - Created user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - Created user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1461,7 +1471,7 @@ print_createUsersWithArrayInput_help() {
|
||||
echo -e "${BOLD}${WHITE}createUsersWithArrayInput - Creates list of users with given input array${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1478,7 +1488,7 @@ print_createUsersWithListInput_help() {
|
||||
echo -e "${BOLD}${WHITE}createUsersWithListInput - Creates list of users with given input array${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1576,7 +1586,7 @@ print_updateUser_help() {
|
||||
echo -e ""
|
||||
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
||||
echo -e " * ${GREEN}username${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - name that need to be deleted ${YELLOW}Specify as: username=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[]${OFF} ${RED}(required)${OFF}${OFF} - Updated user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - Updated user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
||||
echo -e ""
|
||||
echo ""
|
||||
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
||||
@@ -1667,10 +1677,10 @@ call_call123TestSpecialTags() {
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Call createXmlItem operation
|
||||
# Call fooGet operation
|
||||
#
|
||||
##############################################################################
|
||||
call_createXmlItem() {
|
||||
call_fooGet() {
|
||||
# ignore error about 'path_parameter_names' being unused; passed by reference
|
||||
# shellcheck disable=SC2034
|
||||
local path_parameter_names=()
|
||||
@@ -1679,11 +1689,11 @@ call_createXmlItem() {
|
||||
local query_parameter_names=()
|
||||
local path
|
||||
|
||||
if ! path=$(build_request_path "/v2/fake/create_xml_item" path_parameter_names query_parameter_names); then
|
||||
if ! path=$(build_request_path "/v2/foo" path_parameter_names query_parameter_names); then
|
||||
ERROR_MSG=$path
|
||||
exit 1
|
||||
fi
|
||||
local method="POST"
|
||||
local method="GET"
|
||||
local headers_curl
|
||||
headers_curl=$(header_arguments_to_curl)
|
||||
if [[ -n $header_accept ]]; then
|
||||
@@ -1694,54 +1704,46 @@ call_createXmlItem() {
|
||||
if [[ -n $basic_auth_credential ]]; then
|
||||
basic_auth_option="-u ${basic_auth_credential}"
|
||||
fi
|
||||
local body_json_curl=""
|
||||
|
||||
#
|
||||
# Check if the user provided 'Content-type' headers in the
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/xml"
|
||||
echo -e "\\t- application/xml; charset=utf-8"
|
||||
echo -e "\\t- application/xml; charset=utf-16"
|
||||
echo -e "\\t- text/xml"
|
||||
echo -e "\\t- text/xml; charset=utf-8"
|
||||
echo -e "\\t- text/xml; charset=utf-16"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
if [[ "$print_curl" = true ]]; then
|
||||
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
||||
fi
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Call fakeHealthGet operation
|
||||
#
|
||||
##############################################################################
|
||||
call_fakeHealthGet() {
|
||||
# ignore error about 'path_parameter_names' being unused; passed by reference
|
||||
# shellcheck disable=SC2034
|
||||
local path_parameter_names=()
|
||||
# ignore error about 'query_parameter_names' being unused; passed by reference
|
||||
# shellcheck disable=SC2034
|
||||
local query_parameter_names=()
|
||||
local path
|
||||
|
||||
if ! path=$(build_request_path "/v2/fake/health" path_parameter_names query_parameter_names); then
|
||||
ERROR_MSG=$path
|
||||
exit 1
|
||||
fi
|
||||
local method="GET"
|
||||
local headers_curl
|
||||
headers_curl=$(header_arguments_to_curl)
|
||||
if [[ -n $header_accept ]]; then
|
||||
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# If we have received some body content over pipe, pass it from the
|
||||
# temporary file to cURL
|
||||
#
|
||||
if [[ -n $body_content_temp_file ]]; then
|
||||
if [[ "$print_curl" = true ]]; then
|
||||
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
||||
else
|
||||
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
||||
fi
|
||||
rm "${body_content_temp_file}"
|
||||
#
|
||||
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
||||
#
|
||||
local basic_auth_option=""
|
||||
if [[ -n $basic_auth_credential ]]; then
|
||||
basic_auth_option="-u ${basic_auth_credential}"
|
||||
fi
|
||||
if [[ "$print_curl" = true ]]; then
|
||||
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
||||
else
|
||||
body_json_curl=$(body_parameters_to_json)
|
||||
if [[ "$print_curl" = true ]]; then
|
||||
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
||||
else
|
||||
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
||||
fi
|
||||
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1781,10 +1783,19 @@ call_fakeOuterBooleanSerialize() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -1850,10 +1861,19 @@ call_fakeOuterCompositeSerialize() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -1919,10 +1939,19 @@ call_fakeOuterNumberSerialize() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -1988,10 +2017,19 @@ call_fakeOuterStringSerialize() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -2338,7 +2376,7 @@ call_testGroupParameters() {
|
||||
local path_parameter_names=()
|
||||
# ignore error about 'query_parameter_names' being unused; passed by reference
|
||||
# shellcheck disable=SC2034
|
||||
local query_parameter_names=(required_string_group required_int64_group string_group int64_group)
|
||||
local query_parameter_names=(required_string_group required_int64_group string_group int64_group )
|
||||
local path
|
||||
|
||||
if ! path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names); then
|
||||
@@ -3139,10 +3177,19 @@ call_placeOrder() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -3208,10 +3255,19 @@ call_createUser() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -3277,10 +3333,19 @@ call_createUsersWithArrayInput() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -3346,10 +3411,19 @@ call_createUsersWithListInput() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -3559,10 +3633,19 @@ call_updateUser() {
|
||||
# command line. If not try to set them based on the OpenAPI specification
|
||||
# if values produces and consumes are defined unambigously
|
||||
#
|
||||
if [[ -z $header_content_type ]]; then
|
||||
header_content_type="application/json"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z $header_content_type && "$force" = false ]]; then
|
||||
:
|
||||
echo "ERROR: Request's content-type not specified!!!"
|
||||
echo "This operation expects content-type in one of the following formats:"
|
||||
echo -e "\\t- application/json"
|
||||
echo ""
|
||||
echo "Use '--content-type' to set proper content type"
|
||||
exit 1
|
||||
else
|
||||
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
||||
fi
|
||||
@@ -3692,8 +3775,11 @@ case $key in
|
||||
call123TestSpecialTags)
|
||||
operation="call123TestSpecialTags"
|
||||
;;
|
||||
createXmlItem)
|
||||
operation="createXmlItem"
|
||||
fooGet)
|
||||
operation="fooGet"
|
||||
;;
|
||||
fakeHealthGet)
|
||||
operation="fakeHealthGet"
|
||||
;;
|
||||
fakeOuterBooleanSerialize)
|
||||
operation="fakeOuterBooleanSerialize"
|
||||
@@ -3887,8 +3973,11 @@ case $operation in
|
||||
call123TestSpecialTags)
|
||||
call_call123TestSpecialTags
|
||||
;;
|
||||
createXmlItem)
|
||||
call_createXmlItem
|
||||
fooGet)
|
||||
call_fooGet
|
||||
;;
|
||||
fakeHealthGet)
|
||||
call_fakeHealthGet
|
||||
;;
|
||||
fakeOuterBooleanSerialize)
|
||||
call_fakeOuterBooleanSerialize
|
||||
|
||||
@@ -69,7 +69,8 @@ _petstore-cli()
|
||||
# It's modelled as an associative array for efficient key lookup
|
||||
declare -A operations
|
||||
operations["call123TestSpecialTags"]=1
|
||||
operations["createXmlItem"]=1
|
||||
operations["fooGet"]=1
|
||||
operations["fakeHealthGet"]=1
|
||||
operations["fakeOuterBooleanSerialize"]=1
|
||||
operations["fakeOuterCompositeSerialize"]=1
|
||||
operations["fakeOuterNumberSerialize"]=1
|
||||
@@ -110,7 +111,8 @@ _petstore-cli()
|
||||
# Only include path, query and header parameters
|
||||
declare -A operation_parameters
|
||||
operation_parameters["call123TestSpecialTags"]=""
|
||||
operation_parameters["createXmlItem"]=""
|
||||
operation_parameters["fooGet"]=""
|
||||
operation_parameters["fakeHealthGet"]=""
|
||||
operation_parameters["fakeOuterBooleanSerialize"]=""
|
||||
operation_parameters["fakeOuterCompositeSerialize"]=""
|
||||
operation_parameters["fakeOuterNumberSerialize"]=""
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.2.1-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
||||
@@ -49,8 +49,10 @@ public:
|
||||
void uploadFile(const qint64& pet_id, const QString& additional_metadata, const PFXHttpFileElement& file);
|
||||
|
||||
private:
|
||||
QString _scheme, _host, _basePath;
|
||||
int _port, _timeOut;
|
||||
QString _scheme, _host;
|
||||
int _port;
|
||||
QString _basePath;
|
||||
int _timeOut;
|
||||
QString _workingDirectory;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
void addPetCallback (PFXHttpRequestWorker * worker);
|
||||
|
||||
@@ -44,8 +44,10 @@ public:
|
||||
void placeOrder(const PFXOrder& body);
|
||||
|
||||
private:
|
||||
QString _scheme, _host, _basePath;
|
||||
int _port, _timeOut;
|
||||
QString _scheme, _host;
|
||||
int _port;
|
||||
QString _basePath;
|
||||
int _timeOut;
|
||||
QString _workingDirectory;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
void deleteOrderCallback (PFXHttpRequestWorker * worker);
|
||||
|
||||
@@ -48,8 +48,10 @@ public:
|
||||
void updateUser(const QString& username, const PFXUser& body);
|
||||
|
||||
private:
|
||||
QString _scheme, _host, _basePath;
|
||||
int _port, _timeOut;
|
||||
QString _scheme, _host;
|
||||
int _port;
|
||||
QString _basePath;
|
||||
int _timeOut;
|
||||
QString _workingDirectory;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
void createUserCallback (PFXHttpRequestWorker * worker);
|
||||
|
||||
@@ -41,6 +41,19 @@ use OpenAPI\Client\Model\ModelInterface;
|
||||
*/
|
||||
class ObjectSerializer
|
||||
{
|
||||
/** @var string */
|
||||
private static $dateTimeFormat = \DateTime::ATOM;
|
||||
|
||||
/**
|
||||
* Change the date format
|
||||
*
|
||||
* @param string $format the new date format to use
|
||||
*/
|
||||
public static function setDateTimeFormat($format)
|
||||
{
|
||||
self::$dateTimeFormat = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data
|
||||
*
|
||||
@@ -55,7 +68,7 @@ class ObjectSerializer
|
||||
if (is_scalar($data) || null === $data) {
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
|
||||
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
@@ -188,7 +201,7 @@ class ObjectSerializer
|
||||
public static function toString($value)
|
||||
{
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ATOM);
|
||||
return $value->format(self::$dateTimeFormat);
|
||||
} else if (is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,11 @@ class DateTimeSerializerTest extends TestCase
|
||||
$data = ObjectSerializer::sanitizeForSerialization($input);
|
||||
|
||||
$this->assertEquals($data->dateTime, '1973-04-30T17:05:00+02:00');
|
||||
|
||||
ObjectSerializer::setDateTimeFormat(\DateTime::RFC3339_EXTENDED);
|
||||
$dataFraction = ObjectSerializer::sanitizeForSerialization($input);
|
||||
$this->assertEquals($dataFraction->dateTime, '1973-04-30T17:05:00.000+02:00');
|
||||
ObjectSerializer::setDateTimeFormat(\DateTime::ATOM);
|
||||
}
|
||||
|
||||
public function testDateSanitazion()
|
||||
|
||||
@@ -43,18 +43,18 @@ playground.xcworkspace
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
Carthage/Checkouts
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.2.0-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
||||
16
samples/client/petstore/swift4/default/Package.resolved
Normal file
16
samples/client/petstore/swift4/default/Package.resolved
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Alamofire",
|
||||
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4",
|
||||
"version": "4.9.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -305,6 +305,7 @@
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
Base,
|
||||
en,
|
||||
);
|
||||
mainGroup = 5FBA6AE5F64CD737F88B4565;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
||||
@@ -22,7 +22,7 @@ public struct APIHelper {
|
||||
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? Array<Any?> {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@@ -54,7 +54,7 @@ public struct APIHelper {
|
||||
|
||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user