Skip to content
Permalink
Browse files

New generator swift5 (#4086)

* [swift5] introduce new generator

* [swift5] add Swift Package Manager integration and update dependencies

* [swift5] run petstore

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] make CodableHelper more customizable

* [swift] update pet projects

* [swift] update pet projects

* [swift] add nullable support

* [swift] make enums conform to CaseIterable

* [swift] date formatter add support for ISO8601 with and without milliseconds

* [swift] add urlsession support

* [swift] remove unecessary sample unwrapRequired

* [swift] rename JSONEncodableEncoding.swift to JSONDataEncoding.swift

* [swift] use result in generator internals

* [swift] cocoapods remove deprecated docset_url and add watchos deployment target

* [swift] Add ability to pass in a dedicated queue for processing network response (Fix for 230)

* [swift] update pet projects

* [swift] update docs

* [swift] add support for combine

* [swift] update docs

* [swift] update windows bat scripts

* [swift] update windows bat scripts

* [swift] update swift pet project tests

* [swift] update depencies

* [swift] make urlsession the default http client

* [swift] add urlsession sample project

* [swift] add urlsession sample project

* [swift] update docs

* [swift] improve combine unit tests

* [swift] update docs
  • Loading branch information
4brunu authored and wing328 committed Jan 2, 2020
1 parent 39ba6bb commit 5cc5fbe76a03bdb8db4ba9b36bbbca96e2bd1c92
Showing 1,448 changed files with 84,537 additions and 778 deletions.
@@ -49,6 +49,25 @@ workflows:
./samples/client/petstore/swift4/swift4_test_all.sh
./samples/client/test/swift4/swift4_test_all.sh
- script@1.1.5:
title: Update Swift5 samples
inputs:
- content: |
#!/usr/bin/env bash
set -e
sh bin/swift5-all.sh
- script@1.1.5:
title: Run Swift5 tests
inputs:
- content: |
#!/usr/bin/env bash
set -e
./samples/client/petstore/swift5/swift5_test_all.sh
./samples/client/test/swift5/swift5_test_all.sh
- script@1.1.5:
title: Run all bin scripts
inputs:
@@ -0,0 +1,4 @@
#!/bin/sh

./bin/swift5-petstore-all.sh
./bin/swift5-test.sh
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"library": "alamofire"
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-alamofire.json -o samples/client/petstore/swift5/alamofireLibrary --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/alamofireLibrary
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/alamofireLibrary
swiftlint autocorrect
fi
@@ -0,0 +1,12 @@
#!/bin/sh

./bin/swift5-petstore.sh
./bin/swift5-petstore-promisekit.sh
./bin/swift5-petstore-result.sh
./bin/swift5-petstore-rxswift.sh
./bin/swift5-petstore-objcCompatible.sh
./bin/swift5-petstore-nonPublicApi.sh
./bin/swift5-petstore-urlsession.sh
./bin/swift5-petstore-alamofire.sh
./bin/swift5-petstore-combine.sh

@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "Combine"
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-combine.json -o samples/client/petstore/swift5/combineLibrary --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/combineLibrary
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/combineLibrary
swiftlint autocorrect
fi
@@ -0,0 +1,8 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"nonPublicApi": true,
"sortParamsByRequiredFlag": false
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-nonPublicApi.json -o samples/client/petstore/swift5/nonPublicApi --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/nonPublicApi
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/nonPublicApi
swiftlint autocorrect
fi
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"objcCompatible": true
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-objcCompatible.json -o samples/client/petstore/swift5/objcCompatible --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/objcCompatible
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/objcCompatible
swiftlint autocorrect
fi
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-promisekit.json -o samples/client/petstore/swift5/promisekitLibrary --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/promisekitLibrary
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/promisekitLibrary
swiftlint autocorrect
fi
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "Result"
}
@@ -0,0 +1,42 @@
#!/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/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-result.json -o samples/client/petstore/swift5/resultLibrary --generate-alias-as-model $@"

java $JAVA_OPTS -jar $executable $ags

if type "xcodegen" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/resultLibrary
xcodegen generate
fi

if type "swiftlint" > /dev/null 2>&1; then
cd samples/client/petstore/swift5/resultLibrary
swiftlint autocorrect
fi
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "RxSwift"
}

0 comments on commit 5cc5fbe

Please sign in to comment.
You can’t perform that action at this time.