@pikku/openapi-parser 0.12.14 → 0.12.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/codegen.js +4 -3
- package/package.json +1 -1
- package/src/codegen.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @pikku/openapi-parser
|
|
2
2
|
|
|
3
|
+
## 0.12.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 854c342: Fix workspace addon integration: exclude nested pikku projects from inspection (prevents "More than one CoreUserSession/CoreConfig found" when a workspace addon is linked), widen the generated addon service `call()` data param to `unknown` so schema-less function inputs compile, and add `@pikku/inspector` + `@standard-schema/spec` to the generated addon devDependencies so its `.pikku` gen files typecheck.
|
|
8
|
+
|
|
3
9
|
## 0.12.14
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/codegen.js
CHANGED
|
@@ -1035,10 +1035,11 @@ function generateServiceFile(spec, opPairs, vars, flags) {
|
|
|
1035
1035
|
lines.push(' async call<T>(');
|
|
1036
1036
|
lines.push(" method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',");
|
|
1037
1037
|
lines.push(' path: string,');
|
|
1038
|
-
lines.push(' data?:
|
|
1038
|
+
lines.push(' data?: unknown');
|
|
1039
1039
|
lines.push(' ): Promise<T> {');
|
|
1040
|
+
lines.push(' const input = data as Record<string, unknown> | undefined');
|
|
1040
1041
|
if (flags.camelCase) {
|
|
1041
|
-
lines.push(' const rawData =
|
|
1042
|
+
lines.push(' const rawData = input ? _toSnakeCase(input) : input');
|
|
1042
1043
|
}
|
|
1043
1044
|
lines.push(' const route = ROUTES[`${method} ${path}`]');
|
|
1044
1045
|
lines.push(' let endpoint = path');
|
|
@@ -1052,7 +1053,7 @@ function generateServiceFile(spec, opPairs, vars, flags) {
|
|
|
1052
1053
|
lines.push(' }');
|
|
1053
1054
|
lines.push('');
|
|
1054
1055
|
// When camelCase flag is on, use rawData (snake_case converted) for route matching
|
|
1055
|
-
const dataVar = flags.camelCase ? 'rawData' : '
|
|
1056
|
+
const dataVar = flags.camelCase ? 'rawData' : 'input';
|
|
1056
1057
|
lines.push(` if (${dataVar} && route) {`);
|
|
1057
1058
|
lines.push(' // Interpolate path params');
|
|
1058
1059
|
lines.push(' for (const param of route.path) {');
|
package/package.json
CHANGED
package/src/codegen.ts
CHANGED
|
@@ -1397,10 +1397,13 @@ function generateServiceFile(
|
|
|
1397
1397
|
lines.push(' async call<T>(')
|
|
1398
1398
|
lines.push(" method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',")
|
|
1399
1399
|
lines.push(' path: string,')
|
|
1400
|
-
lines.push(' data?:
|
|
1400
|
+
lines.push(' data?: unknown')
|
|
1401
1401
|
lines.push(' ): Promise<T> {')
|
|
1402
|
+
lines.push(
|
|
1403
|
+
' const input = data as Record<string, unknown> | undefined'
|
|
1404
|
+
)
|
|
1402
1405
|
if (flags.camelCase) {
|
|
1403
|
-
lines.push(' const rawData =
|
|
1406
|
+
lines.push(' const rawData = input ? _toSnakeCase(input) : input')
|
|
1404
1407
|
}
|
|
1405
1408
|
lines.push(' const route = ROUTES[`${method} ${path}`]')
|
|
1406
1409
|
lines.push(' let endpoint = path')
|
|
@@ -1416,7 +1419,7 @@ function generateServiceFile(
|
|
|
1416
1419
|
lines.push(' }')
|
|
1417
1420
|
lines.push('')
|
|
1418
1421
|
// When camelCase flag is on, use rawData (snake_case converted) for route matching
|
|
1419
|
-
const dataVar = flags.camelCase ? 'rawData' : '
|
|
1422
|
+
const dataVar = flags.camelCase ? 'rawData' : 'input'
|
|
1420
1423
|
lines.push(` if (${dataVar} && route) {`)
|
|
1421
1424
|
lines.push(' // Interpolate path params')
|
|
1422
1425
|
lines.push(' for (const param of route.path) {')
|