swagger-typescript-api 13.6.2 → 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.
@@ -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.2";
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], operationId);
1880
+ const contentTypes = this.getContentTypes([requestInfo]);
1881
1881
  const links = this.getRouteLinksFromResponse(resolvedSwaggerSchema, requestInfo, status);
1882
1882
  result.push({
1883
1883
  ...requestInfo || {},
@@ -2082,11 +2082,53 @@ var SchemaRoutes = class {
2082
2082
  });
2083
2083
  const idx = responseBodyInfo.responses.indexOf(responseBodyInfo.success.schema);
2084
2084
  const successResponse = responseBodyInfo.success;
2085
- if (successResponse.schema && !successResponse.schema.$ref) {
2086
- const contentKind = successResponse.schema.contentKind;
2087
- const schema = this.getSchemaFromRequestType(successResponse.schema);
2085
+ const contentKind = successResponse.schema?.contentKind;
2086
+ const actualSchema = this.getSchemaFromRequestType(successResponse.schema);
2087
+ if (actualSchema && !actualSchema.$ref) {
2088
2088
  successResponse.schema = this.schemaParserFabric.createParsedComponent({
2089
- 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: {},
2090
2132
  typeName,
2091
2133
  schemaPath: [routeInfo.operationId]
2092
2134
  });
@@ -3581,4 +3623,4 @@ Object.defineProperty(exports, "version", {
3581
3623
  }
3582
3624
  });
3583
3625
 
3584
- //# sourceMappingURL=src-CxPRLeDh.cjs.map
3626
+ //# sourceMappingURL=src-DqcUpLvd.cjs.map