@kubb/adapter-oas 5.0.0-beta.40 → 5.0.0-beta.42
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 +11 -11
- package/dist/index.cjs +21 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter.bench.ts +1 -5
- package/src/adapter.ts +1 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/adapter-oas",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.42",
|
|
4
4
|
"description": "OpenAPI and Swagger adapter for Kubb. Parses and validates OAS 2.0/3.x specifications into a @kubb/ast RootNode for downstream code generation plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"oas": "^32.1.18",
|
|
48
48
|
"oas-normalize": "^16.0.4",
|
|
49
49
|
"swagger2openapi": "^7.0.8",
|
|
50
|
-
"@kubb/core": "5.0.0-beta.
|
|
50
|
+
"@kubb/core": "5.0.0-beta.42"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/swagger2openapi": "^7.0.4",
|
package/src/adapter.bench.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { existsSync } from 'node:fs'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
3
|
import { bench, describe } from 'vitest'
|
|
5
4
|
import { adapterOas } from './adapter.ts'
|
|
6
5
|
import { parseDocument } from './factory.ts'
|
|
@@ -8,10 +7,7 @@ import { parseOas } from './parser.ts'
|
|
|
8
7
|
import type { Document } from './types.ts'
|
|
9
8
|
import type { AdapterSource } from '@kubb/core'
|
|
10
9
|
|
|
11
|
-
const
|
|
12
|
-
const __dirname = path.dirname(__filename)
|
|
13
|
-
|
|
14
|
-
const petStorePath = path.resolve(__dirname, '../mocks/petStore.yaml')
|
|
10
|
+
const petStorePath = path.resolve(import.meta.dirname, '../mocks/petStore.yaml')
|
|
15
11
|
const stripeSpecPath = '/tmp/kubb-stripe-spec3.json'
|
|
16
12
|
const hasStripe = existsSync(stripeSpecPath)
|
|
17
13
|
|
package/src/adapter.ts
CHANGED
|
@@ -206,13 +206,7 @@ export const adapterOas = createAdapter<AdapterOas>((options) => {
|
|
|
206
206
|
async parse(source) {
|
|
207
207
|
const streamNode = await createStream(source)
|
|
208
208
|
|
|
209
|
-
const
|
|
210
|
-
const out: Array<T> = []
|
|
211
|
-
for await (const item of iter) out.push(item)
|
|
212
|
-
return out
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const [schemas, operations] = await Promise.all([collect(streamNode.schemas), collect(streamNode.operations)])
|
|
209
|
+
const [schemas, operations] = await Promise.all([Array.fromAsync(streamNode.schemas), Array.fromAsync(streamNode.operations)])
|
|
216
210
|
|
|
217
211
|
return ast.createInput({ schemas, operations, meta: streamNode.meta })
|
|
218
212
|
},
|