这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev/openapi-ts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default defineConfig(() => {
// 'dutchie.json',
// 'invalid',
// 'full.yaml',
// 'openai.yaml',
'openai.yaml',
// 'opencode.yaml',
'pagination-ref.yaml',
// 'pagination-ref.yaml',
// 'sdk-instance.yaml',
// 'string-with-format.yaml',
// 'transformers.json',
Expand Down
1 change: 1 addition & 0 deletions examples/openapi-ts-axios/src/client/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const createClient = (config: Config = {}): Client => {
try {
// assign Axios here for consistency with fetch
const _axios = opts.axios!;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { auth, ...optsWithoutAuth } = opts;
const response = await _axios({
Expand Down
1 change: 1 addition & 0 deletions examples/openapi-ts-fastify/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const serviceHandlers: RouteHandlers = {
createPets(request, reply) {
reply.code(201).send();
},

listPets(request, reply) {
reply.code(200).send([]);
},
Expand Down
24 changes: 24 additions & 0 deletions examples/openapi-ts-swr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions examples/openapi-ts-swr/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hey API + SWR Demo</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions examples/openapi-ts-swr/openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
input:
'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml',
output: {
format: 'prettier',
lint: 'eslint',
path: './src/client',
},
plugins: [
'@hey-api/client-fetch',
'@hey-api/schemas',
'@hey-api/sdk',
{
enums: 'javascript',
name: '@hey-api/typescript',
},
'swr',
],
});
40 changes: 40 additions & 0 deletions examples/openapi-ts-swr/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@example/openapi-ts-swr",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"build": "tsc && vite build",
"dev": "vite",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"openapi-ts": "openapi-ts",
"preview": "vite preview",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@radix-ui/react-form": "0.1.1",
"@radix-ui/react-icons": "1.3.2",
"@radix-ui/themes": "3.1.6",
"react": "19.0.0",
"react-dom": "19.0.0",
"swr": "2.3.2"
},
"devDependencies": {
"@config/vite-base": "workspace:*",
"@hey-api/openapi-ts": "workspace:*",
"@types/react": "19.0.1",
"@types/react-dom": "19.0.1",
"@typescript-eslint/eslint-plugin": "8.29.1",
"@typescript-eslint/parser": "8.29.1",
"@vitejs/plugin-react": "4.4.0-beta.1",
"autoprefixer": "10.4.19",
"eslint": "9.17.0",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "0.4.7",
"postcss": "8.4.41",
"prettier": "3.4.2",
"tailwindcss": "3.4.9",
"typescript": "5.8.3",
"vite": "7.1.2"
}
}
6 changes: 6 additions & 0 deletions examples/openapi-ts-swr/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
autoprefixer: {},
tailwindcss: {},
},
};
3 changes: 3 additions & 0 deletions examples/openapi-ts-swr/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
Loading
Loading