@kubb/adapter-oas 5.0.0-alpha.19 → 5.0.0-alpha.20

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/src/adapter.ts CHANGED
@@ -5,7 +5,7 @@ import { applyDiscriminatorInheritance } from './discriminator.ts'
5
5
  import { parseFromConfig, validateDocument } from './factory.ts'
6
6
  import { parseOas } from './parser.ts'
7
7
  import { resolveServerUrl } from './resolvers.ts'
8
- import type { AdapterOas } from './types.ts'
8
+ import type { AdapterOas, Document } from './types.ts'
9
9
 
10
10
  /**
11
11
  * Stable string identifier for the OAS adapter used in Kubb's adapter registry.
@@ -47,6 +47,7 @@ export const adapterOas = createAdapter<AdapterOas>((options) => {
47
47
 
48
48
  // Let-binding so parse() can replace it with a simple reassignment (no clear+loop).
49
49
  let nameMapping = new Map<string, string>()
50
+ let parsedDocument: Document | undefined
50
51
 
51
52
  return {
52
53
  name: adapterOasName,
@@ -65,6 +66,9 @@ export const adapterOas = createAdapter<AdapterOas>((options) => {
65
66
  nameMapping,
66
67
  }
67
68
  },
69
+ get document() {
70
+ return parsedDocument
71
+ },
68
72
  getImports(node, resolve) {
69
73
  return collectImports({
70
74
  node,
@@ -100,6 +104,8 @@ export const adapterOas = createAdapter<AdapterOas>((options) => {
100
104
 
101
105
  // This must happen after parseOas() because legacy enum remapping is finalized there.
102
106
  nameMapping = parsedNameMapping
107
+ // Expose the raw document so consumers (e.g. plugin-redoc) can access it.
108
+ parsedDocument = document
103
109
 
104
110
  return createRoot({
105
111
  ...root,
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { adapterOas, adapterOasName } from './adapter.ts'
2
+ export type { AdapterOas } from './types.ts'
package/src/types.ts CHANGED
@@ -206,4 +206,4 @@ export type AdapterOasResolvedOptions = {
206
206
  /**
207
207
  * `@kubb/core` adapter factory type for the OpenAPI adapter.
208
208
  */
209
- export type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasResolvedOptions>
209
+ export type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasResolvedOptions, Document>