Skip to content

Commit 84059f8

Browse files
authored
fix(sdk): zod schema generation (#3436)
1 parent 795d91a commit 84059f8

32 files changed

+5031
-6246
lines changed

api/client/javascript/.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

api/client/javascript/.prettierrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

api/client/javascript/biome.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"assist": {
4+
"actions": {
5+
"source": {
6+
"organizeImports": "on",
7+
"useSortedKeys": "on"
8+
}
9+
}
10+
},
11+
"files": {
12+
"ignoreUnknown": false,
13+
"includes": ["**"],
14+
"maxSize": 20000000
15+
},
16+
"formatter": {
17+
"enabled": true,
18+
"indentStyle": "space",
19+
"useEditorconfig": true
20+
},
21+
"javascript": {
22+
"formatter": {
23+
"arrowParentheses": "always",
24+
"attributePosition": "auto",
25+
"lineWidth": 80,
26+
"quoteStyle": "single",
27+
"semicolons": "asNeeded",
28+
"trailingCommas": "all"
29+
}
30+
},
31+
"linter": {
32+
"enabled": true,
33+
"rules": {
34+
"recommended": true,
35+
"style": {
36+
"noInferrableTypes": "error",
37+
"noParameterAssign": "error",
38+
"noUnusedTemplateLiteral": "error",
39+
"noUselessElse": "error",
40+
"useAsConstAssertion": "error",
41+
"useConst": "error",
42+
"useDefaultParameterLast": "error",
43+
"useEnumInitializers": "error",
44+
"useNumberNamespace": "error",
45+
"useSelfClosingElements": "error",
46+
"useSingleVarDeclarator": "error"
47+
}
48+
}
49+
},
50+
"overrides": [
51+
{
52+
"assist": {
53+
"actions": {
54+
"source": {
55+
"useSortedKeys": "off"
56+
}
57+
}
58+
},
59+
"includes": ["package.json"]
60+
}
61+
],
62+
"vcs": {
63+
"clientKind": "git",
64+
"enabled": true,
65+
"useIgnoreFile": true
66+
}
67+
}

api/client/javascript/eslint.config.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

api/client/javascript/orval.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ export default defineConfig({
66
target: '../../openapi.cloud.yaml',
77
},
88
output: {
9+
biome: true,
910
clean: true,
1011
client: 'zod',
1112
mode: 'single',
1213
namingConvention: 'PascalCase',
1314
override: {
14-
header: () => `
15-
/* eslint-disable no-useless-escape */
16-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
17-
// @ts-nocheck
18-
`,
1915
useDates: true,
2016
zod: {
2117
coerce: {
@@ -34,9 +30,9 @@ export default defineConfig({
3430
},
3531
},
3632
},
37-
prettier: true,
3833
propertySortOrder: 'Alphabetical',
3934
target: './src/zod/index.ts',
35+
tsconfig: './tsconfig.json',
4036
},
4137
},
4238
})

api/client/javascript/package.json

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"url": "https://github.com/openmeterio/openmeter.git",
1010
"directory": "api/client/javascript"
1111
},
12+
"type": "module",
1213
"main": "./dist/index.js",
1314
"types": "./dist/index.d.ts",
1415
"exports": {
@@ -53,75 +54,56 @@
5354
"default": "./dist/src/zod/index.js"
5455
}
5556
},
56-
"type": "module",
57-
"engines": {
58-
"node": ">=22.0.0"
59-
},
6057
"scripts": {
61-
"lint": "eslint . --format=pretty",
62-
"format": "prettier --write .",
6358
"build": "duel",
64-
"generate": "tsx scripts/generate.ts && prettier --write ./src/client/schemas.ts && orval && eslint ./src/zod/index.ts --fix",
59+
"format": "biome format --write .",
60+
"generate": "pnpm run generate:client && pnpm run generate:zod",
61+
"generate:client": "tsx scripts/generate.ts && biome format --write ./src/client/schemas.ts",
62+
"generate:zod": "orval && tsx scripts/add-as-const.ts && biome lint --write ./src/zod/index.ts && biome format --write ./src/zod/index.ts",
63+
"lint": "tsc --noEmit && biome lint .",
64+
"prepublishOnly": "pnpm run generate && pnpm run build && pnpm run lint && pnpm run test",
6565
"pretest": "pnpm run build",
6666
"test": "vitest --run",
67-
"test:watch": "vitest --watch",
68-
"prepublishOnly": "pnpm run generate && pnpm run build && pnpm run lint && pnpm run test"
67+
"test:watch": "vitest --watch"
68+
},
69+
"engines": {
70+
"node": ">=22.0.0"
71+
},
72+
"dependencies": {
73+
"openapi-fetch": "0.14.0",
74+
"openapi-typescript-helpers": "0.0.15"
6975
},
7076
"devDependencies": {
71-
"@eslint/compat": "1.3.1",
72-
"@eslint/eslintrc": "3.3.1",
73-
"@eslint/js": "9.32.0",
74-
"@fetch-mock/vitest": "0.2.14",
77+
"@biomejs/biome": "2.2.4",
78+
"@fetch-mock/vitest": "0.2.15",
7579
"@knighted/duel": "2.1.5",
76-
"@types/node": "22.15.19",
80+
"@types/node": "24.5.2",
7781
"@types/node-fetch": "2.6.13",
78-
"@types/react": "19.1.9",
79-
"@typescript-eslint/eslint-plugin": "8.38.0",
80-
"@typescript-eslint/parser": "8.38.0",
81-
"eslint": "9.32.0",
82-
"eslint-config-prettier": "10.1.8",
83-
"eslint-formatter-pretty": "6.0.1",
84-
"eslint-import-resolver-typescript": "4.4.4",
85-
"eslint-plugin-compat": "6.0.2",
86-
"eslint-plugin-import": "2.32.0",
87-
"eslint-plugin-perfectionist": "4.15.0",
88-
"eslint-plugin-require-extensions": "0.1.3",
89-
"eslint-plugin-unused-imports": "4.1.4",
90-
"eslint-plugin-vitest": "0.5.4",
91-
"fetch-mock": "12.5.3",
82+
"@types/react": "19.1.15",
83+
"fetch-mock": "12.5.4",
9284
"openapi-typescript": "7.8.0",
93-
"orval": "7.11.0",
85+
"orval": "7.13.0",
9486
"prettier": "3.6.2",
9587
"react": "19.1.1",
96-
"rollup": "4.46.2",
88+
"rollup": "4.52.3",
89+
"ts-morph": "27.0.0",
9790
"tslib": "2.8.1",
98-
"tsx": "4.20.3",
99-
"typescript": "5.8.3",
91+
"tsx": "4.20.6",
92+
"typescript": "5.9.2",
10093
"vitest": "3.2.4",
10194
"zod": "3.25.7"
10295
},
103-
"browserslist": [
104-
"current node"
105-
],
106-
"dependencies": {
107-
"openapi-fetch": "0.14.0",
108-
"openapi-typescript-helpers": "0.0.15"
109-
},
96+
"packageManager": "[email protected]+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a",
11097
"peerDependencies": {
11198
"react": ">=18.0.0"
11299
},
113-
"packageManager": "[email protected]+sha512.f0dda8580f0ee9481c5c79a1d927b9164f2c478e90992ad268bbb2465a736984391d6333d2c327913578b2804af33474ca554ba29c04a8b13060a717675ae3ac",
114100
"pnpm": {
115101
"onlyBuiltDependencies": [
116102
"esbuild",
117103
"unrs-resolver"
118104
],
119105
"patchedDependencies": {
120106
"openapi-typescript": "patches/openapi-typescript.patch"
121-
},
122-
"overrides": {
123-
"brace-expansion@>=1.0.0 <=1.1.11": ">=1.1.12",
124-
"brace-expansion@>=2.0.0 <=2.0.1": ">=2.0.2"
125107
}
126108
}
127109
}

0 commit comments

Comments
 (0)