@kubb/adapter-oas 5.0.0-beta.4 → 5.0.0-beta.40

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/types.ts CHANGED
@@ -123,8 +123,9 @@ export type ResponseObject = OASResponseObject
123
123
  export type MediaTypeObject = OASMediaTypeObject
124
124
 
125
125
  /**
126
- * Configuration options for the OpenAPI adapter.
127
- * Controls spec validation, content-type selection, and server URL resolution.
126
+ * Configuration options for the OpenAPI adapter. Controls spec validation,
127
+ * content-type selection, server URL resolution, and how types are derived
128
+ * from the spec.
128
129
  *
129
130
  * @example
130
131
  * ```ts
@@ -138,23 +139,28 @@ export type MediaTypeObject = OASMediaTypeObject
138
139
  */
139
140
  export type AdapterOasOptions = {
140
141
  /**
141
- * Validate the OpenAPI spec before parsing.
142
+ * Validate the OpenAPI spec with `@readme/openapi-parser` before parsing.
143
+ * Set to `false` only when you have a known-invalid spec you still want to
144
+ * generate from.
145
+ *
142
146
  * @default true
143
147
  */
144
148
  validate?: boolean
145
149
  /**
146
- * Preferred content-type used when extracting request/response schemas.
147
- * Defaults to the first valid JSON media type found in the spec.
150
+ * Preferred media type when an operation defines several. Defaults to the
151
+ * first JSON-compatible media type found in the spec.
148
152
  */
149
153
  contentType?: ContentType
150
154
  /**
151
- * Index into `oas.api.servers` for computing `baseURL`.
152
- * `0` first server, `1` second server. Omit to leave `baseURL` undefined.
155
+ * Index into the `servers` array from your OpenAPI spec. Used to compute the
156
+ * base URL for plugins that need it. Most projects pick `0` for the primary
157
+ * server. Omit to leave `baseURL` undefined.
153
158
  */
154
159
  serverIndex?: number
155
160
  /**
156
161
  * Override values for `{variable}` placeholders in the selected server URL.
157
- * Only used when `serverIndex` is set.
162
+ * Only used when `serverIndex` is set. Variables you do not provide use
163
+ * their `default` value from the spec.
158
164
  *
159
165
  * @example
160
166
  * ```ts
@@ -165,12 +171,28 @@ export type AdapterOasOptions = {
165
171
  */
166
172
  serverVariables?: Record<string, string>
167
173
  /**
168
- * How the discriminator field is interpreted.
169
- * - `'strict'` uses `oneOf` schemas as written in the spec.
170
- * - `'inherit'` propagates discriminator values into child schemas from `discriminator.mapping`.
174
+ * How the `discriminator` field on `oneOf`/`anyOf` schemas is interpreted.
175
+ * - `'strict'` child schemas stay exactly as written. The discriminator
176
+ * narrows types at the call site but child shapes are not modified.
177
+ * - `'inherit'` Kubb propagates the discriminator property as a literal
178
+ * value into each child schema, so each branch's discriminator field is
179
+ * precisely typed.
180
+ *
171
181
  * @default 'strict'
172
182
  */
173
183
  discriminator?: 'strict' | 'inherit'
184
+ /**
185
+ * Collapse structurally identical schemas and enums into a single shared definition.
186
+ *
187
+ * Duplicated inline shapes (especially enums repeated across many properties) are hoisted
188
+ * into one named schema. Every other occurrence, and any structurally identical top-level
189
+ * component, becomes a `ref` to it. Equality is shape-only: documentation such as
190
+ * `description` and `example` is ignored. Enabled by default. Set to `false` to keep every
191
+ * occurrence inline and produce byte-for-byte identical output to earlier versions.
192
+ *
193
+ * @default true
194
+ */
195
+ dedupe?: boolean
174
196
  } & Partial<ast.ParserOptions>
175
197
 
176
198
  /**
@@ -182,6 +204,7 @@ export type AdapterOasResolvedOptions = {
182
204
  serverIndex: AdapterOasOptions['serverIndex']
183
205
  serverVariables: AdapterOasOptions['serverVariables']
184
206
  discriminator: NonNullable<AdapterOasOptions['discriminator']>
207
+ dedupe: NonNullable<AdapterOasOptions['dedupe']>
185
208
  dateType: NonNullable<AdapterOasOptions['dateType']>
186
209
  integerType: NonNullable<AdapterOasOptions['integerType']>
187
210
  unknownType: NonNullable<AdapterOasOptions['unknownType']>
File without changes