elysia-openapi-codegen 0.1.4 → 0.1.5
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/README.md +3 -15
- package/dist/index.js +2 -2
- package/package.json +25 -23
- package/dist/index.d.ts +0 -6
- package/dist/types.d.ts +0 -70
package/README.md
CHANGED
|
@@ -318,26 +318,14 @@ your-project/
|
|
|
318
318
|
```bash
|
|
319
319
|
# Install dependencies
|
|
320
320
|
bun install
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Local Development
|
|
324
321
|
|
|
325
|
-
|
|
326
|
-
# Run directly with Bun during development
|
|
322
|
+
# Run the generator locally
|
|
327
323
|
bun index.ts -i ./example/openapi.json -o ./output
|
|
328
324
|
```
|
|
329
325
|
|
|
330
|
-
### Building
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
# Compile TypeScript to JavaScript
|
|
334
|
-
npm run build
|
|
335
|
-
|
|
336
|
-
# Test the compiled version
|
|
337
|
-
node dist/index.js --help
|
|
338
|
-
```
|
|
326
|
+
### Building
|
|
339
327
|
|
|
340
|
-
|
|
328
|
+
This project uses Bun as the runtime. No build step is necessary for development.
|
|
341
329
|
|
|
342
330
|
## How It Works
|
|
343
331
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// index.ts
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import https from "https";
|
|
@@ -11,7 +11,7 @@ async function fetchSpec(source) {
|
|
|
11
11
|
const client = source.startsWith("https://") ? https : http;
|
|
12
12
|
client.get(source, (res) => {
|
|
13
13
|
let data = "";
|
|
14
|
-
res.on("data", (chunk) => data += chunk
|
|
14
|
+
res.on("data", (chunk) => data += chunk);
|
|
15
15
|
res.on("end", () => {
|
|
16
16
|
try {
|
|
17
17
|
resolve(JSON.parse(data));
|
package/package.json
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elysia-openapi-codegen",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Generate React Query hooks and fully typed TypeScript interfaces from Elysia OpenAPI specs.",
|
|
3
5
|
"module": "index.ts",
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "bun build --target=node ./src/index.ts --outfile=dist/index.js && bun run build:declaration",
|
|
11
|
-
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json",
|
|
12
|
-
"postbuild": "rimraf tsconfig.types.tsbuildinfo"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@types/bun": "latest",
|
|
16
|
-
"typescript": "^5"
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"typescript": "^5"
|
|
7
|
+
"bin": {
|
|
8
|
+
"elysia-codegen": "./dist/index.js"
|
|
20
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"author": "Khantamir mkhantamir77@gmail.com",
|
|
15
|
+
"license": "MIT",
|
|
21
16
|
"repository": {
|
|
22
17
|
"type": "git",
|
|
23
18
|
"url": "https://github.com/mkhantamir/elysia-openapi-codegen.git"
|
|
24
19
|
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/mkhantamir/elysia-openapi-codegen/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/mkhantamir/elysia-openapi-codegen#readme",
|
|
25
24
|
"keywords": [
|
|
26
25
|
"elysia",
|
|
27
26
|
"openapi",
|
|
@@ -30,11 +29,14 @@
|
|
|
30
29
|
"react-query",
|
|
31
30
|
"tanstack-query"
|
|
32
31
|
],
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/bun": "latest"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"typescript": "^6.0.2"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "bun build index.ts --outfile dist/index.js --target node"
|
|
40
|
+
},
|
|
41
|
+
"main": "dist/index.js"
|
|
42
|
+
}
|
package/dist/index.d.ts
DELETED
package/dist/types.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export interface OpenAPISpec {
|
|
2
|
-
openapi: string;
|
|
3
|
-
info: {
|
|
4
|
-
title: string;
|
|
5
|
-
version: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
};
|
|
8
|
-
servers?: Array<{
|
|
9
|
-
url: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
}>;
|
|
12
|
-
paths: Record<string, OpenAPIPathItem>;
|
|
13
|
-
components?: {
|
|
14
|
-
schemas?: Record<string, OpenAPISchema>;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
[key: string]: unknown;
|
|
18
|
-
}
|
|
19
|
-
export interface OpenAPIPathItem {
|
|
20
|
-
get?: OpenAPIOperation;
|
|
21
|
-
post?: OpenAPIOperation;
|
|
22
|
-
put?: OpenAPIOperation;
|
|
23
|
-
delete?: OpenAPIOperation;
|
|
24
|
-
patch?: OpenAPIOperation;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
}
|
|
27
|
-
export interface OpenAPIOperation {
|
|
28
|
-
operationId?: string;
|
|
29
|
-
summary?: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
parameters?: OpenAPIParameter[];
|
|
32
|
-
responses?: Record<string, OpenAPIResponse>;
|
|
33
|
-
requestBody?: {
|
|
34
|
-
content: {
|
|
35
|
-
[contentType: string]: {
|
|
36
|
-
schema: OpenAPISchema;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
[key: string]: unknown;
|
|
41
|
-
}
|
|
42
|
-
export interface OpenAPIParameter {
|
|
43
|
-
name: string;
|
|
44
|
-
in: 'query' | 'header' | 'path' | 'cookie';
|
|
45
|
-
description?: string;
|
|
46
|
-
required?: boolean;
|
|
47
|
-
schema?: OpenAPISchema;
|
|
48
|
-
[key: string]: unknown;
|
|
49
|
-
}
|
|
50
|
-
export interface OpenAPIResponse {
|
|
51
|
-
description: string;
|
|
52
|
-
content?: {
|
|
53
|
-
[contentType: string]: {
|
|
54
|
-
schema: OpenAPISchema;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
[key: string]: unknown;
|
|
58
|
-
}
|
|
59
|
-
export interface OpenAPISchema {
|
|
60
|
-
type?: string;
|
|
61
|
-
items?: OpenAPISchema;
|
|
62
|
-
properties?: Record<string, OpenAPISchema>;
|
|
63
|
-
required?: string[];
|
|
64
|
-
$ref?: string;
|
|
65
|
-
nullable?: boolean;
|
|
66
|
-
anyOf?: OpenAPISchema[];
|
|
67
|
-
oneOf?: OpenAPISchema[];
|
|
68
|
-
allOf?: OpenAPISchema[];
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
}
|