@feasibleone/blong-openapi 1.1.4 → 1.2.1
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/CHANGELOG.md +20 -0
- package/README.md +56 -60
- package/package.json +4 -2
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/orchestrator/openapi.d.ts +0 -5
- package/dist/orchestrator/openapi.d.ts.map +0 -1
- package/dist/orchestrator/openapi.js +0 -10
- package/dist/orchestrator/openapi.js.map +0 -1
- package/dist/package.json +0 -31
- package/dist/server.d.ts +0 -5
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -20
- package/dist/server.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.1](https://github.com/feasibleone/blong/compare/blong-openapi-v1.2.0...blong-openapi-v1.2.1) (2026-09-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* split core to folders ([3900de8](https://github.com/feasibleone/blong/commit/3900de88defe8a3e9c492c5cf9388ac4ee81d781))
|
|
9
|
+
|
|
10
|
+
## [1.2.0](https://github.com/feasibleone/blong/compare/blong-openapi-v1.1.4...blong-openapi-v1.2.0) (2026-05-19)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* blong-dev ([8eb1aa4](https://github.com/feasibleone/blong/commit/8eb1aa4a8acb6a3dcdd52fb51582e0403efa4064))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* lint ([e566423](https://github.com/feasibleone/blong/commit/e5664233dee91b8f66eef8fc8ae1f40a33d6c59f))
|
|
21
|
+
* linting ([46d7549](https://github.com/feasibleone/blong/commit/46d7549477c6b863e09972e8c6903a38b5836a8e))
|
|
22
|
+
|
|
3
23
|
## [1.1.4](https://github.com/feasibleone/blong/compare/blong-openapi-v1.1.3...blong-openapi-v1.1.4) (2026-04-26)
|
|
4
24
|
|
|
5
25
|
|
package/README.md
CHANGED
|
@@ -13,15 +13,13 @@ OpenAPI/Swagger integration for the Blong framework
|
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
|
-
`@feasibleone/blong-openapi` provides seamless integration with external REST
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
services without writing manual HTTP request code.
|
|
16
|
+
`@feasibleone/blong-openapi` provides seamless integration with external REST APIs using OpenAPI
|
|
17
|
+
2.0/3.0 (Swagger) definitions. It automatically generates type-safe handlers from API
|
|
18
|
+
specifications, enabling you to call external services without writing manual HTTP request code.
|
|
20
19
|
|
|
21
20
|
## Features
|
|
22
21
|
|
|
23
|
-
- **Automatic Handler Generation**: Parse OpenAPI/Swagger definitions and
|
|
24
|
-
generate callable handlers
|
|
22
|
+
- **Automatic Handler Generation**: Parse OpenAPI/Swagger definitions and generate callable handlers
|
|
25
23
|
- **Type-Safe Integration**: Use `operationId` from API specs as handler names
|
|
26
24
|
- **Multiple API Support**: Configure multiple API namespaces in a single orchestrator
|
|
27
25
|
- **URL & File Support**: Load specifications from local files or remote URLs
|
|
@@ -99,13 +97,13 @@ const result = await this.bus.weatherGetCurrentWeather({
|
|
|
99
97
|
|
|
100
98
|
```yaml
|
|
101
99
|
openapi:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
logLevel: info # Log level for the orchestrator
|
|
101
|
+
namespace: ['api'] # Namespace prefix for calling handlers
|
|
102
|
+
api:
|
|
103
|
+
namespace:
|
|
104
|
+
weather: # API namespace identifier
|
|
105
|
+
- ./api/weather.yaml # OpenAPI/Swagger definition (local)
|
|
106
|
+
- https://api.example.com/swagger.json # or remote URL
|
|
109
107
|
```
|
|
110
108
|
|
|
111
109
|
### Advanced Configuration
|
|
@@ -114,22 +112,22 @@ Configure multiple APIs with custom settings:
|
|
|
114
112
|
|
|
115
113
|
```yaml
|
|
116
114
|
openapi:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
115
|
+
api:
|
|
116
|
+
namespace:
|
|
117
|
+
# External API with custom server override
|
|
118
|
+
payment:
|
|
119
|
+
- https://payment-api.example.com/openapi.json
|
|
120
|
+
- host: 'api.production.com'
|
|
121
|
+
basePath: '/v2'
|
|
122
|
+
x-blong:
|
|
123
|
+
destination: 'paymentService'
|
|
124
|
+
namespace: 'payment'
|
|
125
|
+
|
|
126
|
+
# Kubernetes API integration
|
|
127
|
+
k8s:
|
|
128
|
+
- https://kubernetes.io/api/v1/swagger.json
|
|
129
|
+
- servers:
|
|
130
|
+
- url: 'https://k8s-cluster:6443'
|
|
133
131
|
```
|
|
134
132
|
|
|
135
133
|
### Multiple Definition Files
|
|
@@ -138,12 +136,12 @@ Split large API definitions across multiple files:
|
|
|
138
136
|
|
|
139
137
|
```yaml
|
|
140
138
|
api:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
namespace:
|
|
140
|
+
time:
|
|
141
|
+
- ./api/world-time.yaml # Base OpenAPI definition
|
|
142
|
+
- ./api/world-time.operations.yaml # Additional operationId mappings
|
|
143
|
+
- servers:
|
|
144
|
+
- url: 'http://worldtimeapi.org'
|
|
147
145
|
```
|
|
148
146
|
|
|
149
147
|
## Usage Patterns
|
|
@@ -184,9 +182,9 @@ Deploy as standalone microservice:
|
|
|
184
182
|
|
|
185
183
|
```yaml
|
|
186
184
|
microservice:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
orchestrator: true # Enable orchestrator mode
|
|
186
|
+
gateway:
|
|
187
|
+
port: 8081 # Expose on port 8081
|
|
190
188
|
```
|
|
191
189
|
|
|
192
190
|
### Custom Operation IDs
|
|
@@ -196,10 +194,10 @@ If API doesn't define `operationId`, create mapping file:
|
|
|
196
194
|
```yaml
|
|
197
195
|
# weather-operations.yaml
|
|
198
196
|
paths:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
/weather/current:
|
|
198
|
+
get:
|
|
199
|
+
operationId: getCurrentWeather
|
|
200
|
+
x-blong-method: weatherCurrent # Alternative method name
|
|
203
201
|
```
|
|
204
202
|
|
|
205
203
|
## Handler Naming Convention
|
|
@@ -208,11 +206,11 @@ Generated handlers follow the pattern: `{namespace}{operationId}`
|
|
|
208
206
|
|
|
209
207
|
**Examples:**
|
|
210
208
|
|
|
211
|
-
| Namespace | operationId
|
|
212
|
-
|
|
|
213
|
-
| weather
|
|
214
|
-
| payment
|
|
215
|
-
| k8s
|
|
209
|
+
| Namespace | operationId | Handler Name |
|
|
210
|
+
| --------- | ----------------- | -------------------------- |
|
|
211
|
+
| weather | GetForecast | `weatherGetForecast` |
|
|
212
|
+
| payment | CreateTransaction | `paymentCreateTransaction` |
|
|
213
|
+
| k8s | listNamespaces | `k8sListNamespaces` |
|
|
216
214
|
|
|
217
215
|
Names are case-sensitive and trimmed of whitespace.
|
|
218
216
|
|
|
@@ -237,21 +235,19 @@ Configure incoming webhooks with OpenAPI definitions:
|
|
|
237
235
|
|
|
238
236
|
```yaml
|
|
239
237
|
webhook:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
imports: ['codec.openapi']
|
|
239
|
+
'codec.openapi':
|
|
240
|
+
namespace:
|
|
241
|
+
github:
|
|
242
|
+
- ./api/github-webhooks.yaml
|
|
245
243
|
```
|
|
246
244
|
|
|
247
245
|
## Related Packages
|
|
248
246
|
|
|
249
|
-
- **[@feasibleone/blong](https://www.npmjs.com/package/@feasibleone/blong)** -
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
- **[openapi-types](https://www.npmjs.com/package/openapi-types)** - TypeScript
|
|
254
|
-
types for OpenAPI
|
|
247
|
+
- **[@feasibleone/blong](https://www.npmjs.com/package/@feasibleone/blong)** - Core framework
|
|
248
|
+
- **[@feasibleone/blong-gogo](https://www.npmjs.com/package/@feasibleone/blong-gogo)** - Contains
|
|
249
|
+
base `orchestrator.openapi` and `codec.openapi`
|
|
250
|
+
- **[openapi-types](https://www.npmjs.com/package/openapi-types)** - TypeScript types for OpenAPI
|
|
255
251
|
|
|
256
252
|
## Documentation
|
|
257
253
|
|
|
@@ -262,5 +258,5 @@ webhook:
|
|
|
262
258
|
|
|
263
259
|
## Example Projects
|
|
264
260
|
|
|
265
|
-
See the [test/api](../../
|
|
266
|
-
|
|
261
|
+
See the [test/api](../../test/framework/demo/api/) folder for working examples with world-time API
|
|
262
|
+
integration.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feasibleone/blong-openapi",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/feasibleone/blong.git"
|
|
6
6
|
},
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
"@rushstack/heft": "^1.2.6",
|
|
23
23
|
"@rushstack/heft-lint-plugin": "^1.2.6",
|
|
24
24
|
"@rushstack/heft-typescript-plugin": "^1.3.1",
|
|
25
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^6.0.3",
|
|
26
|
+
"@feasibleone/blong-dev": "1.2.2"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "heft build --clean",
|
|
30
|
+
"ci-lint": "blong-dev lint",
|
|
29
31
|
"ci-publish": "node ../../common/scripts/install-run-rush-pnpm.js publish --access public --provenance"
|
|
30
32
|
}
|
|
31
33
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAaA,KAAK,IAAI,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAAC,CAAC,CAAC;yBASzD,MAAM,IAAI,KAAG,OAAO,CAAC,IAAI,CAAC;AAAhD,wBAeO"}
|
package/dist/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { server } from '@feasibleone/blong';
|
|
2
|
-
const openapiServer = server(blong => ({
|
|
3
|
-
url: import.meta.url,
|
|
4
|
-
validation: blong.type.Object({
|
|
5
|
-
openapi: blong.type.Object({}),
|
|
6
|
-
}),
|
|
7
|
-
children: ['../blong-openapi'],
|
|
8
|
-
config: {
|
|
9
|
-
default: {},
|
|
10
|
-
},
|
|
11
|
-
}));
|
|
12
|
-
const openapi = async (load, config) => {
|
|
13
|
-
const platforms = await Promise.all([
|
|
14
|
-
load(openapiServer, 'impl', config, ['microservice', 'integration', 'dev']),
|
|
15
|
-
]);
|
|
16
|
-
for (const platform of platforms)
|
|
17
|
-
await platform.start();
|
|
18
|
-
};
|
|
19
|
-
export default async (load) => openapi(load, {
|
|
20
|
-
'blong-openapi': {
|
|
21
|
-
openapi: {
|
|
22
|
-
api: {
|
|
23
|
-
namespace: {
|
|
24
|
-
time: [
|
|
25
|
-
'../test/api/world-time.yaml',
|
|
26
|
-
'../test/api/world-time.operations.yaml',
|
|
27
|
-
// {servers: [{url: 'http://localhost:8081'}]},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE1C,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IACpB,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACjC,CAAC;IACF,QAAQ,EAAE,CAAC,kBAAkB,CAAC;IAC9B,MAAM,EAAE;QACJ,OAAO,EAAE,EAAE;KACd;CACJ,CAAC,CAAC,CAAC;AAIJ,MAAM,OAAO,GAAG,KAAK,EAAE,IAAU,EAAE,MAAe,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAuC,MAAM,OAAO,CAAC,GAAG,CAAC;QACpE,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;KAC9E,CAAC,CAAC;IACH,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC7D,CAAC,CAAC;AAEF,eAAe,KAAK,EAAE,IAAU,EAAiB,EAAE,CAC/C,OAAO,CAAC,IAAI,EAAE;IACV,eAAe,EAAE;QACb,OAAO,EAAE;YACL,GAAG,EAAE;gBACD,SAAS,EAAE;oBACP,IAAI,EAAE;wBACF,6BAA6B;wBAC7B,wCAAwC;wBACxC,+CAA+C;qBAClD;iBACJ;aACJ;SACJ;KACJ;CACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../orchestrator/openapi.ts"],"names":[],"mappings":";;;AAEA,wBAOI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../orchestrator/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,eAAe,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/B,OAAO,EAAE,sBAAsB;IAC/B,UAAU,EAAE;QACR,OAAO,EAAE;YACL,QAAQ,EAAE,MAAM;SACnB;KACJ;CACJ,CAAC,CAAC,CAAC"}
|
package/dist/package.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@feasibleone/blong-openapi",
|
|
3
|
-
"version": "1.1.4",
|
|
4
|
-
"repository": {
|
|
5
|
-
"url": "git+https://github.com/feasibleone/blong.git"
|
|
6
|
-
},
|
|
7
|
-
"type": "module",
|
|
8
|
-
"exports": {
|
|
9
|
-
"./server.js": "./dist/server.js",
|
|
10
|
-
"./server.d.ts": "./dist/server.d.ts",
|
|
11
|
-
"./server.ts": "./server.ts",
|
|
12
|
-
"./browser.js": "./dist/browser.js",
|
|
13
|
-
"./browser.d.ts": "./dist/browser.d.ts",
|
|
14
|
-
"./browser.ts": "./browser.ts",
|
|
15
|
-
"./dist/package.json": "./package.json",
|
|
16
|
-
"./package.json": "./package.json"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "heft build --clean",
|
|
20
|
-
"ci-publish": "node ../../common/scripts/install-run-rush-pnpm.js publish --access public --provenance"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@feasibleone/blong": "workspace:^1.0.0"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@rushstack/heft": "^1.2.6",
|
|
27
|
-
"@rushstack/heft-lint-plugin": "^1.2.6",
|
|
28
|
-
"@rushstack/heft-typescript-plugin": "^1.3.1",
|
|
29
|
-
"typescript": "^5.9.3"
|
|
30
|
-
}
|
|
31
|
-
}
|
package/dist/server.d.ts
DELETED
package/dist/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":";;;AAEA,wBAiBI"}
|
package/dist/server.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { realm } from '@feasibleone/blong';
|
|
2
|
-
export default realm(blong => ({
|
|
3
|
-
url: import.meta.url,
|
|
4
|
-
validation: blong.type.Object({
|
|
5
|
-
openapi: blong.type.Object({}),
|
|
6
|
-
}),
|
|
7
|
-
children: ['./orchestrator'],
|
|
8
|
-
config: {
|
|
9
|
-
default: {},
|
|
10
|
-
dev: {},
|
|
11
|
-
microservice: {
|
|
12
|
-
orchestrator: true,
|
|
13
|
-
gateway: {
|
|
14
|
-
port: 8081,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
integration: {},
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,eAAe,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IACpB,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACjC,CAAC;IACF,QAAQ,EAAE,CAAC,gBAAgB,CAAC;IAC5B,MAAM,EAAE;QACJ,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,EAAE;QACP,YAAY,EAAE;YACV,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE;gBACL,IAAI,EAAE,IAAI;aACb;SACJ;QACD,WAAW,EAAE,EAAE;KAClB;CACJ,CAAC,CAAC,CAAC"}
|