@kubb/adapter-oas 5.0.0-beta.2 → 5.0.0-beta.21
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 +98 -0
- package/dist/index.cjs +492 -317
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -49
- package/dist/index.js +492 -314
- package/dist/index.js.map +1 -1
- package/extension.yaml +344 -0
- package/package.json +6 -4
- package/src/adapter.bench.ts +64 -0
- package/src/adapter.ts +76 -42
- package/src/discriminator.ts +57 -40
- package/src/factory.ts +1 -4
- package/src/index.ts +2 -2
- package/src/parser.ts +69 -37
- package/src/refs.ts +16 -4
- package/src/resolvers.ts +12 -13
- package/src/stream.ts +175 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
2
|
import * as _$_kubb_core0 from "@kubb/core";
|
|
3
|
-
import { AdapterFactoryOptions,
|
|
3
|
+
import { AdapterFactoryOptions, ast } from "@kubb/core";
|
|
4
4
|
import { DiscriminatorObject as DiscriminatorObject$2, MediaTypeObject as MediaTypeObject$2, OASDocument, ResponseObject as ResponseObject$2, SchemaObject as SchemaObject$2 } from "oas/types";
|
|
5
5
|
import { Operation as Operation$1 } from "oas/operation";
|
|
6
6
|
|
|
@@ -525,30 +525,9 @@ declare const adapterOasName = "oas";
|
|
|
525
525
|
declare const adapterOas: (options?: AdapterOasOptions | undefined) => _$_kubb_core0.Adapter<AdapterOas>;
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/factory.d.ts
|
|
528
|
-
type ParseOptions = {
|
|
529
|
-
canBundle?: boolean;
|
|
530
|
-
enablePaths?: boolean;
|
|
531
|
-
};
|
|
532
528
|
type ValidateDocumentOptions = {
|
|
533
529
|
throwOnError?: boolean;
|
|
534
530
|
};
|
|
535
|
-
/**
|
|
536
|
-
* Loads and dereferences an OpenAPI document, returning the raw `Document`.
|
|
537
|
-
*
|
|
538
|
-
* Accepts a file path string or an already-parsed document object. File paths are bundled via
|
|
539
|
-
* Redocly to resolve external `$ref`s. Swagger 2.0 documents are automatically up-converted
|
|
540
|
-
* to OpenAPI 3.0 via `swagger2openapi`.
|
|
541
|
-
*
|
|
542
|
-
* @example
|
|
543
|
-
* ```ts
|
|
544
|
-
* const document = await parseDocument('./openapi.yaml')
|
|
545
|
-
* const document = await parse(rawDocumentObject, { canBundle: false })
|
|
546
|
-
* ```
|
|
547
|
-
*/
|
|
548
|
-
declare function parseDocument(pathOrApi: string | Document, {
|
|
549
|
-
canBundle,
|
|
550
|
-
enablePaths
|
|
551
|
-
}?: ParseOptions): Promise<Document>;
|
|
552
531
|
/**
|
|
553
532
|
* Deep-merges multiple OpenAPI documents into a single `Document`.
|
|
554
533
|
*
|
|
@@ -561,32 +540,6 @@ declare function parseDocument(pathOrApi: string | Document, {
|
|
|
561
540
|
* ```
|
|
562
541
|
*/
|
|
563
542
|
declare function mergeDocuments(pathOrApi: Array<string | Document>): Promise<Document>;
|
|
564
|
-
/**
|
|
565
|
-
* Creates a `Document` from an `AdapterSource`.
|
|
566
|
-
*
|
|
567
|
-
* Handles all three source types:
|
|
568
|
-
* - `{ type: 'path' }` — resolves and bundles a local file path or remote URL.
|
|
569
|
-
* - `{ type: 'paths' }` — merges multiple file paths into a single document.
|
|
570
|
-
* - `{ type: 'data' }` — parses an inline string (YAML/JSON) or raw object.
|
|
571
|
-
*
|
|
572
|
-
* @example
|
|
573
|
-
* ```ts
|
|
574
|
-
* const document = await parseFromConfig({ type: 'path', path: './openapi.yaml' })
|
|
575
|
-
* const document = await parseFromConfig({ type: 'data', data: '{"openapi":"3.0.0",...}' })
|
|
576
|
-
* ```
|
|
577
|
-
*/
|
|
578
|
-
declare function parseFromConfig(source: AdapterSource): Promise<Document>;
|
|
579
|
-
/**
|
|
580
|
-
* Validates an OpenAPI document using `oas-normalize` with colorized error output.
|
|
581
|
-
*
|
|
582
|
-
* @example
|
|
583
|
-
* ```ts
|
|
584
|
-
* await validateDocument(document)
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
|
-
declare function validateDocument(document: Document, {
|
|
588
|
-
throwOnError
|
|
589
|
-
}?: ValidateDocumentOptions): Promise<void>;
|
|
590
543
|
//#endregion
|
|
591
|
-
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type HttpMethod, HttpMethods$1 as HttpMethods, type MediaTypeObject$1 as MediaTypeObject, type Operation, type
|
|
544
|
+
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type HttpMethod, HttpMethods$1 as HttpMethods, type MediaTypeObject$1 as MediaTypeObject, type Operation, type ReferenceObject$1 as ReferenceObject, type ResponseObject$1 as ResponseObject, type SchemaObject$1 as SchemaObject, type ValidateDocumentOptions, adapterOas, adapterOasName, mergeDocuments };
|
|
592
545
|
//# sourceMappingURL=index.d.ts.map
|