Skip to content

Commit 9ca5471

Browse files
committed
fix: correctly map body keys in flat mode
1 parent fc701bf commit 9ca5471

File tree

180 files changed

+44
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+44
-369
lines changed

.changeset/stale-parts-warn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hey-api/openapi-ts': patch
3+
---
4+
5+
**plugin(@hey-api/sdk)**: correctly map body keys in flat mode

dev/openapi-ts.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export default defineConfig(() => {
4848
path: path.resolve(
4949
getSpecsPath(),
5050
// '2.0.x',
51-
'3.0.x',
52-
// '3.1.x',
51+
// '3.0.x',
52+
'3.1.x',
5353
// 'circular.yaml',
5454
// 'dutchie.json',
5555
// 'enum-names-values.yaml',
@@ -58,9 +58,9 @@ export default defineConfig(() => {
5858
// 'invalid',
5959
// 'object-property-names.yaml',
6060
// 'openai.yaml',
61-
// 'opencode.yaml',
61+
'opencode.yaml',
6262
// 'pagination-ref.yaml',
63-
'ref-deep.yaml',
63+
// 'ref-deep.yaml',
6464
// 'schema-const.yaml',
6565
// 'sdk-instance.yaml',
6666
// 'sdk-method-class-conflict.yaml',
@@ -121,7 +121,7 @@ export default defineConfig(() => {
121121
'/* eslint-disable */',
122122
'// This file is auto-generated by @hey-api/openapi-ts',
123123
],
124-
// importFileExtension: '.js',
124+
importFileExtension: '.ts',
125125
// indexFile: false,
126126
// nameConflictResolver({ attempt, baseName }) {
127127
// // console.log('resolving conflict for:', { attempt, baseName });
@@ -332,7 +332,7 @@ export default defineConfig(() => {
332332
// fields.unwrap('path')
333333
// },
334334
// include...
335-
// name: '@hey-api/sdk',
335+
name: '@hey-api/sdk',
336336
operations: {
337337
// container: 'object',
338338
// containerName: {

dev/playground.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { DefinePlugin, IR } from '@hey-api/openapi-ts';
2-
import { createOpencode } from '@opencode-ai/sdk';
2+
3+
// import { createOpencode } from '@opencode-ai/sdk';
4+
import { PetStore } from './.gen/sdk.gen.ts';
35

46
type MyPluginConfig = { readonly name: 'myplugin' };
57
type MyPlugin = DefinePlugin<MyPluginConfig>;
@@ -15,8 +17,19 @@ export const handler: MyPlugin['Handler'] = ({ plugin }) => {
1517
};
1618

1719
async function run() {
18-
const { client, server } = await createOpencode();
19-
console.log(client, server);
20+
// const { client, server } = await createOpencode();
21+
// console.log(client, server);
22+
const client = new PetStore();
23+
client.tui.publish({
24+
body: {
25+
properties: {
26+
message: 'Hello from Hey API OpenAPI TS Playground!',
27+
variant: 'success',
28+
},
29+
type: 'tui.toast.show',
30+
},
31+
directory: 'main',
32+
});
2033
}
2134

2235
run();

examples/openapi-ts-angular-common/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-angular/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-axios/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-fastify/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-fetch/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-ky/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

examples/openapi-ts-next/src/client/core/params.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ export const buildClientParams = (
147147
} else {
148148
params[field.map] = value;
149149
}
150-
} else if (key === 'body') {
151-
params.body = value;
152150
} else {
153151
const extra = extraPrefixes.find(([prefix]) =>
154152
key.startsWith(prefix),

0 commit comments

Comments
 (0)