Skip to content

Commit ee269bd

Browse files
authored
Use TS client generator from npm (#2223)
use TS client generator from npm
1 parent 078d171 commit ee269bd

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

docs/update-pinned-api.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Updating the pinned API version
22

3-
## Setup
4-
5-
The API generation script assumes you have `oxide.ts` cloned under the same parent directory as the console and have run `npm install` in there.
6-
73
## Instructions
84

95
1. Update [`OMICRON_VERSION`](/OMICRON_VERSION) with new Omicron commit hash

tools/deno/api-diff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async function genForCommit(commit: string, force: boolean) {
9999
await $`rm -rf ${tmpDir}`
100100
await $`mkdir -p ${tmpDir}`
101101
console.log(`Generating for ${commit}...`)
102-
await $`npx tsx ../oxide.ts/generator/index.ts ${specUrl(commit)} ${tmpDir}`
102+
await $`npx @oxide/openapi-gen-ts@0.1.14 ${specUrl(commit)} ${tmpDir}`
103103
await $`npx prettier --write --log-level error ${tmpDir}`
104104
}
105105

tools/generate_api_client.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ set -o errexit # exit if anything fails
99
set -o pipefail
1010
set -o xtrace
1111

12-
# script assumes oxide.ts is cloned under the same parent dir as console and
13-
# you've run `npm install` over there
14-
1512
OMICRON_SHA=$(head -n 1 OMICRON_VERSION)
1613
GEN_DIR="$PWD/app/api/__generated__"
1714

1815
SPEC_URL="https://raw.githubusercontent.com/oxidecomputer/omicron/$OMICRON_SHA/openapi/nexus.json"
1916

20-
npx tsx ../oxide.ts/generator/index.ts $SPEC_URL $GEN_DIR
17+
npx @oxide/openapi-gen-ts@0.1.14 $SPEC_URL $GEN_DIR --features msw
2118
npx prettier --write --log-level error "$GEN_DIR"
2219

23-
# hack until we start pulling this from npm. we don't want this file
24-
rm "$GEN_DIR/type-test.ts"
25-
2620
cat > $GEN_DIR/OMICRON_VERSION <<EOF
2721
# generated file. do not update manually. see docs/update-pinned-api.md
2822
$OMICRON_SHA

0 commit comments

Comments
 (0)