forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): typecheck generated samples + fixes (OpenAPITools#19903
) * fix(typescript): typecheck generated samples + fixes * wip(today's fortune): The sum of the Universe is zero. * Update .github/workflows/samples-typescript-typecheck.yaml * Update modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache * chore: regenerate samples
- Loading branch information
Showing
139 changed files
with
7,325 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: TypeScript clients type checks | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- samples/** | ||
- bin/ts-typecheck-all.sh | ||
- .github/workflows/samples-typescript-typecheck.yaml | ||
jobs: | ||
build: | ||
name: Typecheck TypeScript samples | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: | ||
- 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Run type checker | ||
run: ./bin/ts-typecheck-all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
log() { | ||
echo "$@" >&2 | ||
} | ||
|
||
npm_install() { | ||
# --ignore-scripts because we don't want to run any pre- or postinstall scripts | ||
# --no-package-lock because we don't want to update or create the package-lock.json | ||
# --no-fund because we don't want to check for funding | ||
# --no-audit because we don't want to run an audit | ||
# --suppress-warnings because we don't want to see any warnings whilst type checking | ||
npm i \ | ||
--suppress-warnings \ | ||
--ignore-scripts \ | ||
--no-package-lock \ | ||
--no-fund \ | ||
--no-audit \ | ||
"$@" | ||
} | ||
|
||
main() { | ||
local root_dir | ||
root_dir=$(git rev-parse --show-toplevel) | ||
local dir | ||
|
||
for dir in $(git ls-files samples | grep 'tsconfig.json$' | xargs -n1 dirname | sort -u); do | ||
if [[ ! -f "${root_dir}/${dir}/.openapi-generator-ignore" ]]; then | ||
# This is not a generated sample; skip it | ||
continue | ||
fi | ||
if [[ ! -f "${root_dir}/${dir}/package.json" ]]; then | ||
# we can't really guarantee that all dependencies are there to do a typecheck... | ||
continue | ||
fi | ||
log "➤ ${dir}" | ||
pushd "${root_dir}/${dir}" > /dev/null | ||
npm_install \ | ||
|| npm_install --force # --force because we have some incompatible peer-dependencies that can't be fixed | ||
npm exec [email protected] --yes -- tsc --noEmit | ||
log "✓ ${dir}" | ||
log | ||
popd > /dev/null | ||
done | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
modules/openapi-generator/src/main/resources/typescript-nestjs/configuration.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.