Skip to content

Commit 0e6c59e

Browse files
authored
Merge pull request #401 from OpenAPI-Qraft/feat/asyncapi
feat: add AsyncAPI support and Introduce unified CLI tool `@qraft/cli`
2 parents ef823e7 + c517bc2 commit 0e6c59e

139 files changed

Lines changed: 12151 additions & 845 deletions

File tree

Some content is hidden

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

.changeset/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
"@openapi-qraft/react",
1212
"@openapi-qraft/tanstack-query-react-types",
1313
"@openapi-qraft/eslint-plugin-query"
14+
],
15+
[
16+
"@qraft/cli",
17+
"@qraft/cli-utils",
18+
"@qraft/test-utils",
19+
"@qraft/asyncapi-plugin",
20+
"@qraft/plugin",
21+
"@qraft/asyncapi-typescript-plugin"
1422
]
1523
],
1624
"linked": [],

.changeset/pre.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
"@openapi-qraft/test-fixtures": "1.1.1",
1616
"@openapi-qraft/ts-factory-code-generator": "1.0.2",
1717
"playground": "0.0.14",
18-
"openapi-qraft-website": "0.0.0"
18+
"openapi-qraft-website": "0.0.0",
19+
"@qraft/cli": "0.0.0",
20+
"@qraft/cli-utils": "0.0.0",
21+
"@qraft/test-utils": "0.0.0",
22+
"@qraft/asyncapi-plugin": "0.0.0",
23+
"@qraft/plugin": "0.0.0",
24+
"@qraft/asyncapi-typescript-plugin": "0.0.0"
1925
},
20-
"changesets": [
21-
"short-suits-shine"
22-
]
26+
"changesets": ["short-suits-shine"]
2327
}

.changeset/public-lies-sell.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@openapi-qraft/tanstack-query-react-plugin': minor
3+
'@qraft/asyncapi-typescript-plugin': minor
4+
'@openapi-qraft/openapi-typescript-plugin': minor
5+
'@qraft/asyncapi-plugin': minor
6+
'@openapi-qraft/plugin': minor
7+
'@openapi-qraft/test-fixtures': minor
8+
'@openapi-qraft/cli': minor
9+
'@qraft/test-utils': minor
10+
'@qraft/cli-utils': minor
11+
'@qraft/plugin': minor
12+
'@qraft/cli': minor
13+
---
14+
15+
16+
Introduce unified CLI tool `@qraft/cli` that extends code generation capabilities beyond OpenAPI to support AsyncAPI
17+
specifications. The new CLI provides three main commands:
18+
19+
- `qraft openapi` - Generate type-safe code from OpenAPI documents (React Query hooks and TypeScript types)
20+
- `qraft asyncapi` - Generate TypeScript types from AsyncAPI documents
21+
- `qraft redocly` - Generate code from Redocly configuration files supporting both OpenAPI and AsyncAPI APIs
22+
23+
The CLI uses a plugin-based architecture where plugins are installed as peer dependencies, allowing users to install
24+
only the plugins they need. It maintains full backward compatibility with existing OpenAPI workflows while adding
25+
seamless support for event-driven API specifications.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
description: OpenAPI Qraft project conventions - architecture, TypeScript, and testing standards
3+
alwaysApply: true
4+
---
5+
6+
# OpenAPI Qraft Project Conventions
7+
8+
## Project Overview
9+
10+
OpenAPI Qraft is a monorepo that generates type-safe TanStack Query React hooks from OpenAPI documents.
11+
12+
### Key Packages
13+
14+
- `@openapi-qraft/cli` - CLI tool for code generation
15+
- `@openapi-qraft/react` - Runtime library with Proxy-based API client
16+
- `@openapi-qraft/plugin` - Core plugin infrastructure and OpenAPI processing
17+
- `@openapi-qraft/tanstack-query-react-plugin` - Service generator plugin
18+
- `@openapi-qraft/openapi-typescript-plugin` - TypeScript types generator
19+
- `@openapi-qraft/tanstack-query-react-types` - Shared type definitions
20+
21+
## Architecture
22+
23+
- **Monorepo**: Yarn 4 workspaces + Turbo for builds
24+
- **Module System**: ESM (`"type": "module"` in package.json)
25+
- **Bundling**: Rollup with SWC for runtime packages
26+
- **Internal Dependencies**: Use `workspace:*` for inter-package dependencies
27+
28+
## TypeScript Conventions
29+
30+
- **Strict Mode**: All packages use strict TypeScript
31+
- **Node Imports**: Use `node:` prefix for built-in modules (e.g., `import { sep } from 'node:path'`)
32+
- **Local Imports**: Use `.js` extension for local imports (e.g., `import { foo } from './foo.js'`)
33+
- **Import Order**: Managed by Prettier plugin - do not manually reorder
34+
- **React Imports**: Do NOT import default React (use named imports like `{ useState }`)
35+
36+
## Testing
37+
38+
- **Framework**: Vitest
39+
- **Test Location**: Either `*.test.ts` next to source or in `tests/` folder
40+
- **HTTP Mocking**: MSW (Mock Service Worker) for React client tests
41+
- **Test Naming**: Use English for test names and descriptions
42+
43+
## Code Style
44+
45+
- **Formatter**: Prettier with single quotes and ES5 trailing commas
46+
- **Comments**: Do not add comments unless explicitly requested
47+
- **Language**: English for all code, tests, and commit messages
48+
49+
## Commands
50+
51+
```bash
52+
yarn build # Build all packages
53+
yarn test # Run tests
54+
yarn lint # Run linting
55+
yarn typecheck # Type checking
56+
yarn dev # Development mode
57+
```

.github/actions/spelling/expect.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
addl
12
amannn
23
APITS
34
apps
45
Batalov
5-
bccc
66
bnpm
77
bnpx
88
bytesin
@@ -45,17 +45,21 @@ jwt
4545
kubb
4646
linkcheck
4747
linting
48+
mdc
4849
monite
4950
mozilla
5051
mryechkin
5152
mycdn
5253
myclient
5354
myqraft
5455
nbf
56+
nlights
5557
nnull
5658
nochange
5759
npmrc
5860
npx
61+
nqry
62+
oapi
5963
openapis
6064
opensource
6165
ordercer
@@ -74,18 +78,22 @@ refetched
7478
Refetches
7579
remarkjs
7680
remarkrc
81+
reqid
7782
retext
7883
rfc
7984
sitemap
85+
Smartylighting
8086
somedomain
8187
srv
8288
ssr
89+
streetlights
8390
swcrc
8491
TAdditional
8592
tagline
8693
tarball
8794
TAsync
8895
TCombined
96+
TCommand
8997
TContext
9098
TData
9199
TInfinite
@@ -111,6 +119,7 @@ URLTo
111119
usagge
112120
usernames
113121
Vapi
122+
varnames
114123
verdaccio
115124
versioned
116125
versioning
@@ -121,3 +130,4 @@ workaround
121130
workflows
122131
workspaces
123132
XMonite
133+
Zcf

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/setup-node@v4
2424
with:
2525
cache: 'yarn'
26-
node-version: 20.12.2
26+
node-version: 20.19.6
2727

2828
- name: Install Dependencies
2929
run: yarn install --immutable

.github/workflows/deploy-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/setup-node@v4
2828
with:
2929
cache: 'yarn'
30-
node-version: 20.12.2
30+
node-version: 20.19.6
3131

3232
- name: Install dependencies
3333
run: yarn install --immutable

.github/workflows/docs-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/setup-node@v4
2222
with:
2323
cache: 'yarn'
24-
node-version: 20.12.2
24+
node-version: 20.19.6
2525

2626
- name: Install dependencies
2727
run: yarn install --immutable

.github/workflows/e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
uses: actions/setup-node@v4
2727
with:
2828
cache: 'yarn'
29-
node-version: 20.12.2
29+
node-version: 20.19.6
3030

3131
- name: Install Dependencies
3232
run: yarn install --immutable
3333

3434
- name: Build
35-
run: yarn build --filter "@openapi-qraft/*"
35+
run: yarn build --filter "@openapi-qraft/*" --filter "@qraft/*"
3636

3737
- name: Copy Playground for E2E Tests
3838
run: |

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/setup-node@v4
2525
with:
2626
cache: 'yarn'
27-
node-version: 20.12.2
27+
node-version: 20.19.6
2828

2929
- name: Install Dependencies
3030
run: yarn install --immutable

0 commit comments

Comments
 (0)