@kubb/adapter-oas 5.0.0-beta.50 → 5.0.0-beta.52

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.cjs CHANGED
@@ -27,11 +27,8 @@ oas = __toESM(oas, 1);
27
27
  let node_path = require("node:path");
28
28
  node_path = __toESM(node_path, 1);
29
29
  let node_fs_promises = require("node:fs/promises");
30
- let _redocly_openapi_core = require("@redocly/openapi-core");
31
30
  let oas_normalize = require("oas-normalize");
32
31
  oas_normalize = __toESM(oas_normalize, 1);
33
- let swagger2openapi = require("swagger2openapi");
34
- swagger2openapi = __toESM(swagger2openapi, 1);
35
32
  let _kubb_ast_utils = require("@kubb/ast/utils");
36
33
  let oas_types = require("oas/types");
37
34
  let oas_utils = require("oas/utils");
@@ -632,8 +629,8 @@ function isDiscriminator(obj) {
632
629
  * Loads and dereferences an OpenAPI document, returning the raw `Document`.
633
630
  *
634
631
  * Accepts a file path string or an already-parsed document object. File paths are bundled via
635
- * Redocly to resolve external `$ref`s. Swagger 2.0 documents are automatically up-converted
636
- * to OpenAPI 3.0 via `swagger2openapi`.
632
+ * `@apidevtools/json-schema-ref-parser` to resolve external `$ref`s. Swagger 2.0 documents are
633
+ * automatically up-converted to OpenAPI 3.0 via `swagger2openapi`.
637
634
  *
638
635
  * @example
639
636
  * ```ts
@@ -642,20 +639,20 @@ function isDiscriminator(obj) {
642
639
  * ```
643
640
  */
644
641
  async function parseDocument(pathOrApi, { canBundle = true, enablePaths = true } = {}) {
645
- if (typeof pathOrApi === "string" && canBundle) return parseDocument((await (0, _redocly_openapi_core.bundle)({
646
- ref: pathOrApi,
647
- config: await (0, _redocly_openapi_core.loadConfig)(),
648
- base: pathOrApi
649
- })).bundle.parsed, {
650
- canBundle,
651
- enablePaths
652
- });
642
+ if (typeof pathOrApi === "string" && canBundle) {
643
+ const { $RefParser } = await import("@apidevtools/json-schema-ref-parser");
644
+ return parseDocument(await $RefParser.bundle(pathOrApi), {
645
+ canBundle: false,
646
+ enablePaths
647
+ });
648
+ }
653
649
  const document = await new oas_normalize.default(pathOrApi, {
654
650
  enablePaths,
655
651
  colorizeErrors: true
656
652
  }).load();
657
653
  if (isOpenApiV2Document(document)) {
658
- const { openapi } = await swagger2openapi.default.convertObj(document, { anchors: true });
654
+ const { default: swagger2openapi } = await import("swagger2openapi");
655
+ const { openapi } = await swagger2openapi.convertObj(document, { anchors: true });
659
656
  return openapi;
660
657
  }
661
658
  return document;
@@ -2613,21 +2610,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
2613
2610
  };
2614
2611
  });
2615
2612
  //#endregion
2616
- //#region src/types.ts
2617
- /**
2618
- * Maps uppercase HTTP method names to lowercase for backwards compatibility.
2619
- *
2620
- * @example
2621
- * ```ts
2622
- * HttpMethods['GET'] // 'get'
2623
- * HttpMethods['POST'] // 'post'
2624
- * ```
2625
- */
2626
- const HttpMethods = Object.fromEntries(Object.entries(_kubb_core.ast.httpMethods).map(([lower, upper]) => [upper, lower]));
2627
- //#endregion
2628
- exports.HttpMethods = HttpMethods;
2629
2613
  exports.adapterOas = adapterOas;
2630
2614
  exports.adapterOasName = adapterOasName;
2631
- exports.mergeDocuments = mergeDocuments;
2632
2615
 
2633
2616
  //# sourceMappingURL=index.cjs.map