swagger-typescript-api 13.8.0 → 13.9.0

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.
@@ -208,7 +208,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
208
208
  //#endregion
209
209
  //#region package.json
210
210
  var name = "swagger-typescript-api";
211
- var version = "13.8.0";
211
+ var version = "13.9.0";
212
212
  var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
213
213
  //#endregion
214
214
  //#region src/constants.ts
@@ -714,6 +714,23 @@ var SchemaComponentsMap = class {
714
714
  parseRef = (ref) => {
715
715
  return ref.split("/");
716
716
  };
717
+ getByLocalFragmentRef($ref) {
718
+ if (!$ref.startsWith("#")) return null;
719
+ const [, rawFragment = ""] = $ref.split("#");
720
+ const fragment = rawFragment.startsWith("/") ? rawFragment.slice(1) : rawFragment;
721
+ if (!fragment || fragment.includes("/")) return null;
722
+ let fragmentName = fragment;
723
+ try {
724
+ fragmentName = decodeURIComponent(fragment);
725
+ } catch {}
726
+ const matchingComponents = this._data.filter((component) => {
727
+ if (!component.$ref.startsWith("#")) return false;
728
+ const [, rawPointer = ""] = component.$ref.split("#");
729
+ const componentName = (rawPointer.startsWith("/") ? rawPointer.slice(1) : rawPointer).split("/").filter(Boolean).at(-1);
730
+ return component.typeName === fragmentName || componentName === fragmentName;
731
+ });
732
+ return matchingComponents.length === 1 ? matchingComponents[0] : null;
733
+ }
717
734
  createComponentDraft($ref, rawTypeData) {
718
735
  if (yummies_type_guard.typeGuard.isObject(rawTypeData) && rawTypeData.typeName && rawTypeData.rawTypeData && rawTypeData.$ref) return rawTypeData;
719
736
  const parsed = this.parseRef($ref);
@@ -746,7 +763,7 @@ var SchemaComponentsMap = class {
746
763
  return this._data.filter((it) => componentNames.some((componentName) => it.$ref.startsWith(`#/components/${componentName}`)));
747
764
  }
748
765
  get = ($ref) => {
749
- const localFound = this._data.find((c) => c.$ref === $ref) || null;
766
+ const localFound = this._data.find((c) => c.$ref === $ref) || this.getByLocalFragmentRef($ref) || null;
750
767
  if (localFound != null) return localFound;
751
768
  const { resolvedSwaggerSchema } = this.config;
752
769
  if (resolvedSwaggerSchema.isLocalRef($ref)) return null;
@@ -4019,4 +4036,4 @@ Object.defineProperty(exports, "version", {
4019
4036
  }
4020
4037
  });
4021
4038
 
4022
- //# sourceMappingURL=src-NUsiu5_Q.cjs.map
4039
+ //# sourceMappingURL=src-HisTG6gD.cjs.map