@kubb/adapter-oas 4.36.1 → 5.0.0-alpha.10

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/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import * as _kubb_core0 from "@kubb/core";
3
3
  import { AdapterFactoryOptions } from "@kubb/core";
4
- import { DiscriminatorObject, OASDocument, SchemaObject } from "oas/types";
4
+ import { DiscriminatorObject, OASDocument, ParameterObject, SchemaObject } from "oas/types";
5
5
  import BaseOas from "oas";
6
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
7
  import { Operation } from "oas/operation";
8
+ import { OpenAPIV3 } from "openapi-types";
8
9
 
9
10
  //#region src/oas/types.d.ts
10
11
  type contentType = 'application/json' | (string & {});
@@ -24,10 +25,30 @@ type SchemaObject$1 = SchemaObject & {
24
25
  */
25
26
  contentMediaType?: string;
26
27
  $ref?: string;
28
+ /**
29
+ * OAS 3.1 / JSON Schema: positional items in a tuple schema.
30
+ * Replaces the OAS 3.0 multi-item `items` array syntax.
31
+ */
32
+ prefixItems?: Array<SchemaObject$1 | ReferenceObject>;
33
+ /**
34
+ * JSON Schema: maps regex patterns to sub-schemas for additional property validation.
35
+ */
36
+ patternProperties?: Record<string, SchemaObject$1 | boolean>;
37
+ /**
38
+ * OAS 3.0 / JSON Schema: single-schema form.
39
+ * The OAS base type already includes this, but we re-declare it here to ensure
40
+ * the single-schema overload takes precedence over the multi-schema tuple form.
41
+ */
42
+ items?: SchemaObject$1 | ReferenceObject;
43
+ /**
44
+ * Enum values for this schema (narrowed from `unknown[]` in the base type).
45
+ */
46
+ enum?: Array<string | number | boolean | null>;
27
47
  };
28
48
  type Document = OASDocument;
29
49
  type Operation$1 = Operation;
30
50
  type DiscriminatorObject$1 = DiscriminatorObject;
51
+ type ReferenceObject = OpenAPIV3.ReferenceObject;
31
52
  //#endregion
32
53
  //#region src/oas/Oas.d.ts
33
54
  type OasOptions = {
@@ -52,6 +73,15 @@ declare class Oas extends BaseOas {
52
73
  dereferenceWithRef<T = unknown>(schema?: T): T;
53
74
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
54
75
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
76
+ /**
77
+ * Returns all resolved parameters for an operation, merging path-level and operation-level
78
+ * parameters and deduplicating by `in:name` (operation-level takes precedence).
79
+ *
80
+ * oas v31+ filters out `$ref` parameters in `getParameters()`, so this method accesses the
81
+ * raw `operation.schema.parameters` and path-item parameters directly and resolves `$ref`
82
+ * pointers via `dereferenceWithRef` to preserve backward compatibility.
83
+ */
84
+ getParameters(operation: Operation$1): Array<ParameterObject>;
55
85
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
56
86
  validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
57
87
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
@@ -149,6 +179,12 @@ type OasAdapterResolvedOptions = {
149
179
  integerType: NonNullable<OasAdapterOptions['integerType']>;
150
180
  unknownType: NonNullable<OasAdapterOptions['unknownType']>;
151
181
  emptySchemaType: NonNullable<OasAdapterOptions['emptySchemaType']>;
182
+ /**
183
+ * Map from original `$ref` paths to their collision-resolved schema names.
184
+ * Populated by the adapter after each `parse()` call.
185
+ * e.g. `'#/components/schemas/Order'` → `'OrderSchema'`
186
+ */
187
+ nameMapping: Map<string, string>;
152
188
  };
153
189
  type OasAdapter = AdapterFactoryOptions<'oas', OasAdapterOptions, OasAdapterResolvedOptions>;
154
190
  //#endregion