Skip to content

Commit

Permalink
feat: add typescript-fetch (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Mar 24, 2024
1 parent 48cef92 commit e234cae
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 3 deletions.
9 changes: 9 additions & 0 deletions config/client/typescript-fetch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
npmName: "${NPM_NAME}-fetch"
npmVersion: $VERSION
# typescriptThreePlus: true
supportsES6: true
ensureUniqueParams: true
modelPropertyNaming: original
disallowAdditionalPropertiesIfNotPresent: false
withInterfaces: false
useSingleRequestParameter: true
2 changes: 1 addition & 1 deletion config/client/typescript.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
npmName: "${NPM_NAME}"
npmName: "${NPM_NAME}-fetch"
npmVersion: $VERSION
# typescriptThreePlus: true
supportsES6: true
Expand Down
29 changes: 27 additions & 2 deletions scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,37 @@ typescript () {
-c ./config/client/typescript.yml.proc.yml

file="${dir}/package.json"
jq -r ".author = "'"'"ORY GmbH"'"'" | .license = "'"'"Apache-2.0"'"' "${file}" \
jq -r ".author = "'"'"Ory Corp"'"'" | .license = "'"'"Apache-2.0"'"' "${file}" \
> tmp.$$.json && mv tmp.$$.json "${file}"

cat "${file}"
cp "LICENSE" "clients/${PROJECT}/typescript"
}

typescript_fetch () {
echo "Generating TypeScript Fetch..."

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

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

file="${dir}/package.json"
jq -r ".author = "'"'"Ory Corp"'"'" | .license = "'"'"Apache-2.0"'"' "${file}" \
> tmp.$$.json && mv tmp.$$.json "${file}"

cat "${file}"
cp "LICENSE" "clients/${PROJECT}/typescript-fetch"
}

java () {
echo "Generating Java..."

Expand Down Expand Up @@ -144,7 +168,7 @@ php() {

file="${dir}/composer.json"

jq -r ".name=\"${PHP_PACKAGE_NAME}-php\" | .homepage = \"https://github.com/ory/${GIT_REPO}-php\" | .authors[0].name = \"Ory GmbH\" | .authors[0].homepage = \"https://www.ory.sh\" | .license = \"Apache-2.0\"" "${file}" \
jq -r ".name=\"${PHP_PACKAGE_NAME}-php\" | .homepage = \"https://github.com/ory/${GIT_REPO}-php\" | .authors[0].name = \"Ory Corp\" | .authors[0].homepage = \"https://www.ory.sh\" | .license = \"Apache-2.0\"" "${file}" \
> tmp.$$.json && mv tmp.$$.json "${file}"

cat "${file}"
Expand Down Expand Up @@ -323,6 +347,7 @@ elixir () {

elixir
typescript
typescript_fetch
rust
golang
java
Expand Down
10 changes: 10 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ typescript() {
to_git "js" "yes"
}

typescript-fetch() {
dir="clients/${PROJECT}/typescript-fetch"

(cd "${dir}"; npm install; npm run build)
(cd "${dir}"; npm version -f --no-git-tag-version "${VERSION}" || true; npm publish --access public)

to_git "ts-fetch" "yes"
}

java() {
gitdir=$(mktemp -d -t "${GIT_REPO}-java.XXXXXX")
to_git "java" "no" "$gitdir"
Expand Down Expand Up @@ -236,6 +245,7 @@ ruby || let "FAIL+=1"
golang || let "FAIL+=1"
php || let "FAIL+=1"
typescript || let "FAIL+=1"
typescript_fetch || let "FAIL+=1"
dart || let "FAIL+=1"
rust || let "FAIL+=1"
elixir || let "FAIL+=1"
Expand Down
8 changes: 8 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ typescript () {
(cd "$dir" && npm i && npm run build)
}

typescript_fetch () {
echo "Testing TypeScript Fetch..."

dir="clients/${PROJECT}/typescript-fetch"
(cd "$dir" && npm i && npm run build)
}

java () {
echo "Testing Java..."

Expand Down Expand Up @@ -96,6 +103,7 @@ elixir () {

elixir
typescript
typescript_fetch
rust
golang
java
Expand Down
1 change: 1 addition & 0 deletions spec/client/v1.9.1.json

Large diffs are not rendered by default.

0 comments on commit e234cae

Please sign in to comment.