swagger-typescript-api 13.6.1 → 13.6.3
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 +2 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BPSpx7Sf.mjs → src-Cs2Ms4ew.mjs} +53 -8
- package/dist/src-Cs2Ms4ew.mjs.map +1 -0
- package/dist/{src-DEFrSruL.cjs → src-DqcUpLvd.cjs} +53 -8
- package/dist/src-DqcUpLvd.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/src-BPSpx7Sf.mjs.map +0 -1
- package/dist/src-DEFrSruL.cjs.map +0 -1
|
@@ -213,7 +213,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region package.json
|
|
215
215
|
var name = "swagger-typescript-api";
|
|
216
|
-
var version = "13.6.
|
|
216
|
+
var version = "13.6.3";
|
|
217
217
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/constants.ts
|
|
@@ -1877,7 +1877,7 @@ var SchemaRoutes = class {
|
|
|
1877
1877
|
getRequestInfoTypes = ({ requestInfos, parsedSchemas, operationId, defaultType, resolvedSwaggerSchema }) => {
|
|
1878
1878
|
const result = [];
|
|
1879
1879
|
for (const [status, requestInfo] of Object.entries(requestInfos || {})) {
|
|
1880
|
-
const contentTypes = this.getContentTypes([requestInfo]
|
|
1880
|
+
const contentTypes = this.getContentTypes([requestInfo]);
|
|
1881
1881
|
const links = this.getRouteLinksFromResponse(resolvedSwaggerSchema, requestInfo, status);
|
|
1882
1882
|
result.push({
|
|
1883
1883
|
...requestInfo || {},
|
|
@@ -1951,13 +1951,16 @@ var SchemaRoutes = class {
|
|
|
1951
1951
|
return `headers: { ${Object.entries(headerTypes).map(([k, v]) => `"${k}": ${v}`).join(",")} },`;
|
|
1952
1952
|
};
|
|
1953
1953
|
const typesToCheck = (Array.isArray(originalProduces) && originalProduces.length > 0 ? originalProduces : null) ?? (produces?.length ? produces : null) ?? (successContentTypes?.length ? successContentTypes : null) ?? contentTypes;
|
|
1954
|
+
const isBinarySuccessType = this.isBinaryOnlyContentTypes(typesToCheck);
|
|
1954
1955
|
return {
|
|
1955
1956
|
contentTypes,
|
|
1956
1957
|
responses: responseInfos,
|
|
1957
1958
|
links,
|
|
1959
|
+
typesToCheck,
|
|
1958
1960
|
success: {
|
|
1961
|
+
isBinary: isBinarySuccessType,
|
|
1959
1962
|
schema: successResponse,
|
|
1960
|
-
type:
|
|
1963
|
+
type: isBinarySuccessType ? this.config.Ts.Keyword.Blob : successResponse?.type || this.config.Ts.Keyword.Any
|
|
1961
1964
|
},
|
|
1962
1965
|
error: {
|
|
1963
1966
|
schemas: errorResponses,
|
|
@@ -2079,11 +2082,53 @@ var SchemaRoutes = class {
|
|
|
2079
2082
|
});
|
|
2080
2083
|
const idx = responseBodyInfo.responses.indexOf(responseBodyInfo.success.schema);
|
|
2081
2084
|
const successResponse = responseBodyInfo.success;
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
+
const contentKind = successResponse.schema?.contentKind;
|
|
2086
|
+
const actualSchema = this.getSchemaFromRequestType(successResponse.schema);
|
|
2087
|
+
if (actualSchema && !actualSchema.$ref) {
|
|
2085
2088
|
successResponse.schema = this.schemaParserFabric.createParsedComponent({
|
|
2086
|
-
schema,
|
|
2089
|
+
schema: actualSchema,
|
|
2090
|
+
typeName,
|
|
2091
|
+
schemaPath: [routeInfo.operationId]
|
|
2092
|
+
});
|
|
2093
|
+
successResponse.schema.contentKind = contentKind;
|
|
2094
|
+
if (successResponse.schema.typeData) successResponse.schema.typeData.isExtractedResponseBody = true;
|
|
2095
|
+
successResponse.type = this.schemaParserFabric.getInlineParseContent({ $ref: successResponse.schema.$ref });
|
|
2096
|
+
if (idx > -1) Object.assign(responseBodyInfo.responses[idx], {
|
|
2097
|
+
...successResponse.schema,
|
|
2098
|
+
type: successResponse.type
|
|
2099
|
+
});
|
|
2100
|
+
} else if (responseBodyInfo.success.isBinary) {
|
|
2101
|
+
successResponse.schema = this.schemaParserFabric.createParsedComponent({
|
|
2102
|
+
schema: {
|
|
2103
|
+
type: "string",
|
|
2104
|
+
format: "byte"
|
|
2105
|
+
},
|
|
2106
|
+
typeName,
|
|
2107
|
+
schemaPath: [routeInfo.operationId]
|
|
2108
|
+
});
|
|
2109
|
+
successResponse.schema.contentKind = contentKind;
|
|
2110
|
+
if (successResponse.schema.typeData) successResponse.schema.typeData.isExtractedResponseBody = true;
|
|
2111
|
+
successResponse.type = this.config.Ts.Keyword.Blob;
|
|
2112
|
+
if (idx > -1) Object.assign(responseBodyInfo.responses[idx], {
|
|
2113
|
+
...successResponse.schema,
|
|
2114
|
+
type: successResponse.type
|
|
2115
|
+
});
|
|
2116
|
+
} else if (actualSchema?.$ref) {
|
|
2117
|
+
successResponse.schema = this.schemaParserFabric.createParsedComponent({
|
|
2118
|
+
schema: actualSchema,
|
|
2119
|
+
typeName,
|
|
2120
|
+
schemaPath: [routeInfo.operationId]
|
|
2121
|
+
});
|
|
2122
|
+
successResponse.schema.contentKind = contentKind;
|
|
2123
|
+
if (successResponse.schema.typeData) successResponse.schema.typeData.isExtractedResponseBody = true;
|
|
2124
|
+
successResponse.type = this.schemaParserFabric.getInlineParseContent({ $ref: successResponse.schema.$ref });
|
|
2125
|
+
if (idx > -1) Object.assign(responseBodyInfo.responses[idx], {
|
|
2126
|
+
...successResponse.schema,
|
|
2127
|
+
type: successResponse.type
|
|
2128
|
+
});
|
|
2129
|
+
} else if (successResponse.schema && actualSchema === null && (responseBodyInfo.success.type === this.config.Ts.Keyword.Any || responseBodyInfo.success.type === this.config.defaultResponseType)) {
|
|
2130
|
+
successResponse.schema = this.schemaParserFabric.createParsedComponent({
|
|
2131
|
+
schema: {},
|
|
2087
2132
|
typeName,
|
|
2088
2133
|
schemaPath: [routeInfo.operationId]
|
|
2089
2134
|
});
|
|
@@ -3578,4 +3623,4 @@ Object.defineProperty(exports, "version", {
|
|
|
3578
3623
|
}
|
|
3579
3624
|
});
|
|
3580
3625
|
|
|
3581
|
-
//# sourceMappingURL=src-
|
|
3626
|
+
//# sourceMappingURL=src-DqcUpLvd.cjs.map
|