swagger-typescript-api 13.8.0 → 13.9.1
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/cli.cjs +7 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +7 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-NUsiu5_Q.cjs → src-D9gGLQw-.cjs} +21 -3
- package/dist/src-D9gGLQw-.cjs.map +1 -0
- package/dist/{src-BqYeoXPt.mjs → src-P0mq0CeT.mjs} +21 -3
- package/dist/src-P0mq0CeT.mjs.map +1 -0
- package/package.json +3 -3
- package/templates/default/procedure-call.ejs +2 -2
- package/templates/modular/procedure-call.ejs +2 -2
- package/dist/src-BqYeoXPt.mjs.map +0 -1
- package/dist/src-NUsiu5_Q.cjs.map +0 -1
|
@@ -169,7 +169,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region package.json
|
|
171
171
|
var name = "swagger-typescript-api";
|
|
172
|
-
var version = "13.
|
|
172
|
+
var version = "13.9.1";
|
|
173
173
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/constants.ts
|
|
@@ -330,6 +330,7 @@ var CodeGenConfig = class {
|
|
|
330
330
|
};
|
|
331
331
|
resolvedSwaggerSchema;
|
|
332
332
|
defaultResponseType;
|
|
333
|
+
defaultRequestParams = "{}";
|
|
333
334
|
singleHttpClient = false;
|
|
334
335
|
httpClientType = HTTP_CLIENT.FETCH;
|
|
335
336
|
unwrapResponseData = false;
|
|
@@ -675,6 +676,23 @@ var SchemaComponentsMap = class {
|
|
|
675
676
|
parseRef = (ref) => {
|
|
676
677
|
return ref.split("/");
|
|
677
678
|
};
|
|
679
|
+
getByLocalFragmentRef($ref) {
|
|
680
|
+
if (!$ref.startsWith("#")) return null;
|
|
681
|
+
const [, rawFragment = ""] = $ref.split("#");
|
|
682
|
+
const fragment = rawFragment.startsWith("/") ? rawFragment.slice(1) : rawFragment;
|
|
683
|
+
if (!fragment || fragment.includes("/")) return null;
|
|
684
|
+
let fragmentName = fragment;
|
|
685
|
+
try {
|
|
686
|
+
fragmentName = decodeURIComponent(fragment);
|
|
687
|
+
} catch {}
|
|
688
|
+
const matchingComponents = this._data.filter((component) => {
|
|
689
|
+
if (!component.$ref.startsWith("#")) return false;
|
|
690
|
+
const [, rawPointer = ""] = component.$ref.split("#");
|
|
691
|
+
const componentName = (rawPointer.startsWith("/") ? rawPointer.slice(1) : rawPointer).split("/").filter(Boolean).at(-1);
|
|
692
|
+
return component.typeName === fragmentName || componentName === fragmentName;
|
|
693
|
+
});
|
|
694
|
+
return matchingComponents.length === 1 ? matchingComponents[0] : null;
|
|
695
|
+
}
|
|
678
696
|
createComponentDraft($ref, rawTypeData) {
|
|
679
697
|
if (typeGuard.isObject(rawTypeData) && rawTypeData.typeName && rawTypeData.rawTypeData && rawTypeData.$ref) return rawTypeData;
|
|
680
698
|
const parsed = this.parseRef($ref);
|
|
@@ -707,7 +725,7 @@ var SchemaComponentsMap = class {
|
|
|
707
725
|
return this._data.filter((it) => componentNames.some((componentName) => it.$ref.startsWith(`#/components/${componentName}`)));
|
|
708
726
|
}
|
|
709
727
|
get = ($ref) => {
|
|
710
|
-
const localFound = this._data.find((c) => c.$ref === $ref) || null;
|
|
728
|
+
const localFound = this._data.find((c) => c.$ref === $ref) || this.getByLocalFragmentRef($ref) || null;
|
|
711
729
|
if (localFound != null) return localFound;
|
|
712
730
|
const { resolvedSwaggerSchema } = this.config;
|
|
713
731
|
if (resolvedSwaggerSchema.isLocalRef($ref)) return null;
|
|
@@ -3909,4 +3927,4 @@ async function generateApi(config) {
|
|
|
3909
3927
|
//#endregion
|
|
3910
3928
|
export { SCHEMA_TYPES as a, constants_exports as c, version as d, RequestContentKind as i, description as l, generateTemplates as n, CodeGenConfig as o, TemplatesGenConfig as r, HTTP_CLIENT as s, generateApi as t, name as u };
|
|
3911
3929
|
|
|
3912
|
-
//# sourceMappingURL=src-
|
|
3930
|
+
//# sourceMappingURL=src-P0mq0CeT.mjs.map
|