@hedystia/swagger 1.7.4 → 1.7.6
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/package.json +2 -2
- package/readme.md +165 -165
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hedystia/swagger",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@types/bun": "^1.3.3",
|
|
6
6
|
"tsup": "^8.3.5"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@apidevtools/swagger-parser": "^10.1.1",
|
|
10
|
-
"hedystia": "^1.7.
|
|
10
|
+
"hedystia": "^1.7.6",
|
|
11
11
|
"openapi-types": "^12.1.3"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<p>
|
|
3
|
-
<strong>🚀 Hedystia Framework</strong>
|
|
4
|
-
</p>
|
|
5
|
-
|
|
6
|
-
<p>
|
|
7
|
-
<strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
|
|
8
|
-
</p>
|
|
9
|
-
|
|
10
|
-
<p>
|
|
11
|
-
<a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
|
|
13
|
-
<a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
|
|
14
|
-
<img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
|
|
15
|
-
</p>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
## 🌟 Superpowers
|
|
19
|
-
|
|
20
|
-
- 🌐 **Multi-runtime support** - Bun (default), Deno, Node.js, Vercel, Cloudflare Workers, Fastly Compute, Lambda, etc.
|
|
21
|
-
- 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
|
|
22
|
-
- ⚡ **Bun-native performance** - Built for Bun runtime with native validation
|
|
23
|
-
- 🧩 **Client integration** - Auto-generated type-safe HTTP client
|
|
24
|
-
- 🛡️ **Validation built-in** - Zod integration for runtime safety
|
|
25
|
-
- 🔌 **Extensible architecture** - Middleware, hooks and macros system
|
|
26
|
-
- 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
|
|
27
|
-
|
|
28
|
-
## 🚀 Launch in 30 Seconds
|
|
29
|
-
|
|
30
|
-
1. Install with Bun:
|
|
31
|
-
```bash
|
|
32
|
-
bun add hedystia
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2. Create your first API:
|
|
36
|
-
```typescript
|
|
37
|
-
import { Hedystia, h } from "hedystia";
|
|
38
|
-
|
|
39
|
-
const app = new Hedystia()
|
|
40
|
-
.get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
|
|
41
|
-
params: h.object({ name: h.string() }),
|
|
42
|
-
response: h.string()
|
|
43
|
-
})
|
|
44
|
-
.listen(3000);
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
3. Generate client and consume API:
|
|
48
|
-
```typescript
|
|
49
|
-
import { createClient } from "@hedystia/client";
|
|
50
|
-
|
|
51
|
-
const client = createClient<typeof app>("http://localhost:3000");
|
|
52
|
-
|
|
53
|
-
// Fully typed request!
|
|
54
|
-
const { data } = await client.hello.name("World").get();
|
|
55
|
-
console.log(data); // "Hello World!"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## 💡 Why Developers Love Hedystia
|
|
59
|
-
|
|
60
|
-
### 🔄 Full-stack Type Safety
|
|
61
|
-
```typescript
|
|
62
|
-
// Server-side validation
|
|
63
|
-
.post("/users", (ctx) => {...}, {
|
|
64
|
-
body: h.object({
|
|
65
|
-
email: h.email(),
|
|
66
|
-
age: h.number()
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
// Client-side types
|
|
71
|
-
await client.users.post({
|
|
72
|
-
body: {
|
|
73
|
-
email: "user@example.com", // Autocompletes!
|
|
74
|
-
age: 25 // Type-checked
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 📖 Swagger Integration
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
import { swagger } from "@hedystia/swagger";
|
|
83
|
-
|
|
84
|
-
const swaggerPlugin = swagger({
|
|
85
|
-
title: "My API",
|
|
86
|
-
description: "An example API with Swagger",
|
|
87
|
-
version: "1.0.0",
|
|
88
|
-
tags: [
|
|
89
|
-
{ name: "users", description: "User operations" },
|
|
90
|
-
],
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
app.use("/swagger", swaggerPlugin.plugin(app));
|
|
94
|
-
|
|
95
|
-
app.listen(3000);
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### ⚡ Performance First
|
|
99
|
-
- Bun runtime optimized
|
|
100
|
-
- Faster by default
|
|
101
|
-
- Own type validation system
|
|
102
|
-
- Faster than Express
|
|
103
|
-
- Built-in response compression
|
|
104
|
-
|
|
105
|
-
### 🧩 Modern Feature Set
|
|
106
|
-
```typescript
|
|
107
|
-
// File uploads
|
|
108
|
-
.post("/upload", async (ctx) => {
|
|
109
|
-
const formData = await ctx.body; // FormData type
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
// Binary responses
|
|
113
|
-
.get("/pdf", () => new Blob([...]), {
|
|
114
|
-
response: h.instanceof(Blob)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
// Nested routing
|
|
118
|
-
.group("/api/v1", (v1) => v1
|
|
119
|
-
.group("/users", (users) => users
|
|
120
|
-
.get("/:id", ...)
|
|
121
|
-
)
|
|
122
|
-
)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## 🛠️ Development Roadmap
|
|
126
|
-
|
|
127
|
-
### Core Features
|
|
128
|
-
- ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
|
|
129
|
-
- ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
|
|
130
|
-
- ✅ Router Groups & Middleware
|
|
131
|
-
- ✅ Type-safe Client Generation
|
|
132
|
-
- ✅ WebSocket Support
|
|
133
|
-
- ✅ Adapter System to work with other frameworks
|
|
134
|
-
|
|
135
|
-
### Advanced Capabilities
|
|
136
|
-
- ✅ Standard Schema Compatibility
|
|
137
|
-
- ✅ Hooks System (onRequest, onError, etc)
|
|
138
|
-
- ✅ Macro System for Auth/Rate Limiting
|
|
139
|
-
- ✅ OpenAPI - Swagger Integration
|
|
140
|
-
|
|
141
|
-
## 💼 Production Ready
|
|
142
|
-
```typescript
|
|
143
|
-
// Error handling
|
|
144
|
-
.onError((err) => {
|
|
145
|
-
return Response.json({
|
|
146
|
-
error: err.message
|
|
147
|
-
}, { status: 500 })
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
// Rate limiting macro
|
|
151
|
-
.macro({
|
|
152
|
-
rateLimit: () => ({
|
|
153
|
-
resolve: async (ctx) => {
|
|
154
|
-
// Implement your logic
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## 📜 License
|
|
161
|
-
MIT License © 2025 Hedystia
|
|
162
|
-
|
|
163
|
-
## 🗣️ Community
|
|
164
|
-
- [GitHub Issues](https://github.com/Hedystia/Framework/issues)
|
|
165
|
-
- [Discord Server](https://hedystia.com/support)
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<strong>🚀 Hedystia Framework</strong>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
|
|
13
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
## 🌟 Superpowers
|
|
19
|
+
|
|
20
|
+
- 🌐 **Multi-runtime support** - Bun (default), Deno, Node.js, Vercel, Cloudflare Workers, Fastly Compute, Lambda, etc.
|
|
21
|
+
- 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
|
|
22
|
+
- ⚡ **Bun-native performance** - Built for Bun runtime with native validation
|
|
23
|
+
- 🧩 **Client integration** - Auto-generated type-safe HTTP client
|
|
24
|
+
- 🛡️ **Validation built-in** - Zod integration for runtime safety
|
|
25
|
+
- 🔌 **Extensible architecture** - Middleware, hooks and macros system
|
|
26
|
+
- 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
|
|
27
|
+
|
|
28
|
+
## 🚀 Launch in 30 Seconds
|
|
29
|
+
|
|
30
|
+
1. Install with Bun:
|
|
31
|
+
```bash
|
|
32
|
+
bun add hedystia
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Create your first API:
|
|
36
|
+
```typescript
|
|
37
|
+
import { Hedystia, h } from "hedystia";
|
|
38
|
+
|
|
39
|
+
const app = new Hedystia()
|
|
40
|
+
.get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
|
|
41
|
+
params: h.object({ name: h.string() }),
|
|
42
|
+
response: h.string()
|
|
43
|
+
})
|
|
44
|
+
.listen(3000);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Generate client and consume API:
|
|
48
|
+
```typescript
|
|
49
|
+
import { createClient } from "@hedystia/client";
|
|
50
|
+
|
|
51
|
+
const client = createClient<typeof app>("http://localhost:3000");
|
|
52
|
+
|
|
53
|
+
// Fully typed request!
|
|
54
|
+
const { data } = await client.hello.name("World").get();
|
|
55
|
+
console.log(data); // "Hello World!"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 💡 Why Developers Love Hedystia
|
|
59
|
+
|
|
60
|
+
### 🔄 Full-stack Type Safety
|
|
61
|
+
```typescript
|
|
62
|
+
// Server-side validation
|
|
63
|
+
.post("/users", (ctx) => {...}, {
|
|
64
|
+
body: h.object({
|
|
65
|
+
email: h.email(),
|
|
66
|
+
age: h.number()
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// Client-side types
|
|
71
|
+
await client.users.post({
|
|
72
|
+
body: {
|
|
73
|
+
email: "user@example.com", // Autocompletes!
|
|
74
|
+
age: 25 // Type-checked
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 📖 Swagger Integration
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { swagger } from "@hedystia/swagger";
|
|
83
|
+
|
|
84
|
+
const swaggerPlugin = swagger({
|
|
85
|
+
title: "My API",
|
|
86
|
+
description: "An example API with Swagger",
|
|
87
|
+
version: "1.0.0",
|
|
88
|
+
tags: [
|
|
89
|
+
{ name: "users", description: "User operations" },
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
app.use("/swagger", swaggerPlugin.plugin(app));
|
|
94
|
+
|
|
95
|
+
app.listen(3000);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### ⚡ Performance First
|
|
99
|
+
- Bun runtime optimized
|
|
100
|
+
- Faster by default
|
|
101
|
+
- Own type validation system
|
|
102
|
+
- Faster than Express
|
|
103
|
+
- Built-in response compression
|
|
104
|
+
|
|
105
|
+
### 🧩 Modern Feature Set
|
|
106
|
+
```typescript
|
|
107
|
+
// File uploads
|
|
108
|
+
.post("/upload", async (ctx) => {
|
|
109
|
+
const formData = await ctx.body; // FormData type
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Binary responses
|
|
113
|
+
.get("/pdf", () => new Blob([...]), {
|
|
114
|
+
response: h.instanceof(Blob)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// Nested routing
|
|
118
|
+
.group("/api/v1", (v1) => v1
|
|
119
|
+
.group("/users", (users) => users
|
|
120
|
+
.get("/:id", ...)
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 🛠️ Development Roadmap
|
|
126
|
+
|
|
127
|
+
### Core Features
|
|
128
|
+
- ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
|
|
129
|
+
- ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
|
|
130
|
+
- ✅ Router Groups & Middleware
|
|
131
|
+
- ✅ Type-safe Client Generation
|
|
132
|
+
- ✅ WebSocket Support
|
|
133
|
+
- ✅ Adapter System to work with other frameworks
|
|
134
|
+
|
|
135
|
+
### Advanced Capabilities
|
|
136
|
+
- ✅ Standard Schema Compatibility
|
|
137
|
+
- ✅ Hooks System (onRequest, onError, etc)
|
|
138
|
+
- ✅ Macro System for Auth/Rate Limiting
|
|
139
|
+
- ✅ OpenAPI - Swagger Integration
|
|
140
|
+
|
|
141
|
+
## 💼 Production Ready
|
|
142
|
+
```typescript
|
|
143
|
+
// Error handling
|
|
144
|
+
.onError((err) => {
|
|
145
|
+
return Response.json({
|
|
146
|
+
error: err.message
|
|
147
|
+
}, { status: 500 })
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// Rate limiting macro
|
|
151
|
+
.macro({
|
|
152
|
+
rateLimit: () => ({
|
|
153
|
+
resolve: async (ctx) => {
|
|
154
|
+
// Implement your logic
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 📜 License
|
|
161
|
+
MIT License © 2025 Hedystia
|
|
162
|
+
|
|
163
|
+
## 🗣️ Community
|
|
164
|
+
- [GitHub Issues](https://github.com/Hedystia/Framework/issues)
|
|
165
|
+
- [Discord Server](https://hedystia.com/support)
|