Skip to content

Commit 7eebbef

Browse files
authored
Merge pull request #1596 from hey-api/fix/text-plain-body-serializer
fix: do not use a body serializer on text/plain sdks
2 parents 548e5d8 + 4784727 commit 7eebbef

File tree

37 files changed

+486
-29
lines changed

37 files changed

+486
-29
lines changed

.changeset/neat-donkeys-pay.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+
fix: do not use a body serializer on text/plain sdks

.changeset/six-horses-report.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@hey-api/client-axios': patch
3+
'@hey-api/client-fetch': patch
4+
'@hey-api/client-nuxt': patch
5+
'@hey-api/openapi-ts': patch
6+
---
7+
8+
fix: add null to valid bodySerializer types

examples/openapi-ts-sample/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

examples/openapi-ts-sample/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Hey API + Fetch API Demo</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from '@hey-api/openapi-ts';
2+
3+
export default defineConfig({
4+
client: '@hey-api/client-fetch',
5+
input:
6+
'../../packages/openapi-ts/test/spec/2.0.x/body-response-text-plain.yaml',
7+
output: {
8+
format: 'prettier',
9+
lint: 'eslint',
10+
path: './src/client',
11+
},
12+
plugins: [
13+
'@hey-api/schemas',
14+
'@hey-api/sdk',
15+
{
16+
enums: 'javascript',
17+
name: '@hey-api/typescript',
18+
},
19+
],
20+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@example/openapi-ts-sample",
3+
"private": true,
4+
"version": "0.0.1",
5+
"type": "module",
6+
"scripts": {
7+
"build": "tsc && vite build",
8+
"dev": "vite",
9+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10+
"openapi-ts": "openapi-ts",
11+
"preview": "vite preview",
12+
"typecheck": "tsc --noEmit"
13+
},
14+
"dependencies": {
15+
"@hey-api/client-fetch": "workspace:*",
16+
"@radix-ui/react-form": "0.1.1",
17+
"@radix-ui/react-icons": "1.3.2",
18+
"@radix-ui/themes": "3.1.6",
19+
"react": "19.0.0",
20+
"react-dom": "19.0.0"
21+
},
22+
"devDependencies": {
23+
"@hey-api/openapi-ts": "workspace:*",
24+
"@types/react": "19.0.1",
25+
"@types/react-dom": "19.0.1",
26+
"@typescript-eslint/eslint-plugin": "7.18.0",
27+
"@typescript-eslint/parser": "7.15.0",
28+
"@vitejs/plugin-react": "4.3.1",
29+
"autoprefixer": "10.4.19",
30+
"eslint": "9.17.0",
31+
"eslint-plugin-react-hooks": "4.6.2",
32+
"eslint-plugin-react-refresh": "0.4.7",
33+
"postcss": "8.4.39",
34+
"prettier": "3.4.2",
35+
"tailwindcss": "3.4.4",
36+
"typescript": "5.5.3",
37+
"vite": "6.0.7"
38+
}
39+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
autoprefixer: {},
4+
tailwindcss: {},
5+
},
6+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import './App.css';
2+
3+
import {
4+
Box,
5+
Button,
6+
Container,
7+
Flex,
8+
Heading,
9+
Section,
10+
} from '@radix-ui/themes';
11+
12+
import { postFoo } from './client/sdk.gen';
13+
14+
function App() {
15+
const onClick = async () => {
16+
postFoo({
17+
body: 'foo',
18+
});
19+
};
20+
21+
return (
22+
<Box
23+
style={{ background: 'var(--gray-a2)', borderRadius: 'var(--radius-3)' }}
24+
>
25+
<Container size="1">
26+
<Section size="1" />
27+
<Flex align="center">
28+
<Heading>sample for internal testing</Heading>
29+
</Flex>
30+
<Section size="1" />
31+
<Flex direction="column" gapY="2">
32+
<Button onClick={onClick}>Click me</Button>
33+
</Flex>
34+
<Section size="1" />
35+
</Container>
36+
</Box>
37+
);
38+
}
39+
40+
export default App;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
export * from './sdk.gen';
3+
export * from './types.gen';

0 commit comments

Comments
 (0)