Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add swift sdk (WIP) #313

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ FROM openjdk:15-buster

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates ssh bash

ENV GOLANG_VERSION 1.17
RUN apt-get -y install libncurses5 clang libcurl4 libpython2.7 libpython2.7-dev

RUN \
curl https://download.swift.org/swift-5.8.1-release/ubuntu1804/swift-5.8.1-RELEASE/swift-5.8.1-RELEASE-ubuntu18.04.tar.gz -o swift.tar.gz &&\
tar xzf swift.tar.gz && \
mv swift-5.8.1-RELEASE-ubuntu18.04 /usr/share/swift && \
export PATH=/usr/share/swift/usr/bin:$PATH && \
swift -v

ENV PATH /usr/share/swift/usr/bin:$PATH

ENV GOLANG_VERSION 1.17
RUN set -eux; \
apt-get install -y --no-install-recommends bash build-essential openssl golang-go curl wget; \
rm -rf /var/lib/apt/lists/*; \
Expand Down Expand Up @@ -126,6 +136,8 @@ RUN gem install bundler -v 2.3.26 && \
apt-get update && \
apt-get install -y --no-install-recommends ruby-dev



ADD go.mod go.mod
ADD go.sum go.sum
RUN go build -o /usr/local/bin/ory github.com/ory/cli
Expand Down
8 changes: 8 additions & 0 deletions config/client/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
podAuthors: ORY GmbH
podHomepage: https://www.ory.sh
podDescription: Ory Swift Client (TODO)
podSource: "${SWIFT_POD_SOURCE}"
podVersion: $RAW_VERSION
projectName: ${SWIFT_PROJECT_NAME}

disallowAdditionalPropertiesIfNotPresent: false
46 changes: 36 additions & 10 deletions scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,41 @@ elixir () {
cp "LICENSE" "clients/${PROJECT}/elixir"
}

elixir
typescript
rust
golang
java
php
python
ruby
dotnet
dart

swift () {
echo "Generating Swift..."

dir="clients/${PROJECT}/swift"
rm -rf "$dir" || true
mkdir -p "$dir"

# file="${dir}/mix.exs"

openapi-generator-cli version-manager set 7.1.0
openapi-generator-cli generate -i "${SPEC_FILE}" \
-g swift5 \
-o "$dir" \
--git-user-id ory \
--git-repo-id sdk \
--git-host github.com \
-c ./config/client/swift.yml.proc.yml

# (sed "s/licenses:.*$/licenses: [\"Apache-2.0\"],\n links: %{\n \"GitHub\" => \"https:\/\/github.com\/ory\/sdk\",\n \"Website\" => \"https:\/\/www.ory.sh\",\n \"Documentation\" => \"https:\/\/www.ory.sh\/docs\",\n \"Product\" => \"https:\/\/console.ory.sh\"\n }/g" < "${file}") > tmp.$$.exs && mv tmp.$$.exs "${file}"
# (sed "s/${VERSION}/${RAW_VERSION}/g" < "${file}") > tmp.$$.exs && mv tmp.$$.exs "${file}"

cp "LICENSE" "clients/${PROJECT}/swift"
}

# elixir
# typescript
# rust
# golang
# java
# php
# python
# ruby
# dotnet
# dart
swift

cleanup
5 changes: 5 additions & 0 deletions scripts/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export NPM_NAME="@ory/$PROJECT-client"

export ELIXIR_PACKAGE_NAME="ory_${PROJECT}"

export SWIFT_PROJECT_NAME="Ory${PROJECT_UCF}Client"
export SWIFT_POD_SOURCE="https://github.com/ory/sdk/tree/master/clients/${PROJECT}/swift"

export GIT_REPO="${PROJECT}-client"

if [ $project == "client" ]; then
Expand All @@ -110,5 +113,7 @@ if [ $project == "client" ]; then

export ELIXIR_PACKAGE_NAME="ory_client"

export SWIFT_PROJECT_NAME="OryClient"

export GIT_REPO="client"
fi
29 changes: 19 additions & 10 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,22 @@ elixir () {
(cd "${dir}"; mix test)
}

elixir
typescript
rust
golang
java
php
python
ruby
dart
csharp
swift() {
echo "Testing Swift..."

dir="clients/${PROJECT}/swift"
(cd "$dir" && command swift build)
(cd "$dir" && command swift test)
}

# elixir
# typescript
# rust
# golang
# java
# php
# python
# ruby
# dart
# csharp
swift
Loading