@rexeus/typeweaver-types 0.10.5 → 0.12.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.
package/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@ function writeRequestType(templateFilePath, resourceName, operation, context) {
57
57
  headerTsType: header ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(header)) : void 0,
58
58
  queryTsType: query ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(query)) : void 0,
59
59
  paramTsType: param ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(param)) : void 0,
60
- bodyTsType: body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(body)) : void 0
60
+ bodyTsType: body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(body.schema)) : void 0
61
61
  });
62
62
  const relativePath = node_path.default.relative(context.outputDir, outputPaths.requestFile);
63
63
  context.writeFile(relativePath, content);
@@ -12843,6 +12843,7 @@ function generate$2(context) {
12843
12843
  function writeRequestValidator(templateFilePath, resourceName, operation, context) {
12844
12844
  const { operationId, request } = operation;
12845
12845
  const { body, query, param, header } = request ?? {};
12846
+ const hasRequestSchema = body !== void 0 || header !== void 0 || param !== void 0 || query !== void 0;
12846
12847
  const outputPaths = context.getOperationOutputPaths({
12847
12848
  resourceName,
12848
12849
  operationId
@@ -12859,6 +12860,7 @@ function writeRequestValidator(templateFilePath, resourceName, operation, contex
12859
12860
  query,
12860
12861
  param,
12861
12862
  header,
12863
+ hasRequestSchema,
12862
12864
  z: external_exports
12863
12865
  });
12864
12866
  const relativePath = node_path.default.relative(context.outputDir, outputPaths.requestValidationFile);
@@ -12920,7 +12922,7 @@ function createOwnResponseTemplateData(response, responseFactoryTemplateFile, co
12920
12922
  };
12921
12923
  return {
12922
12924
  ...factoryData,
12923
- body: response.body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.body)) : void 0,
12925
+ body: response.body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.body.schema)) : void 0,
12924
12926
  header: response.header ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.header)) : void 0,
12925
12927
  statusCode: response.statusCode,
12926
12928
  factory: renderResponseFactory(responseFactoryTemplateFile, factoryData, context, " ")
@@ -12929,7 +12931,7 @@ function createOwnResponseTemplateData(response, responseFactoryTemplateFile, co
12929
12931
  function writeCanonicalResponseType(templateFile, responseFactoryTemplateFile, response, context) {
12930
12932
  const pascalCaseName = (0, polycase.pascalCase)(response.name);
12931
12933
  const headerTsType = response.header ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.header)) : void 0;
12932
- const bodyTsType = response.body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.body)) : void 0;
12934
+ const bodyTsType = response.body ? (0, _rexeus_typeweaver_zod_to_ts.print)((0, _rexeus_typeweaver_zod_to_ts.fromZod)(response.body.schema)) : void 0;
12933
12935
  const factoryData = {
12934
12936
  identifierName: pascalCaseName,
12935
12937
  typeValue: response.name,
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ function writeRequestType(templateFilePath, resourceName, operation, context) {
36
36
  headerTsType: header ? print(fromZod(header)) : void 0,
37
37
  queryTsType: query ? print(fromZod(query)) : void 0,
38
38
  paramTsType: param ? print(fromZod(param)) : void 0,
39
- bodyTsType: body ? print(fromZod(body)) : void 0
39
+ bodyTsType: body ? print(fromZod(body.schema)) : void 0
40
40
  });
41
41
  const relativePath = path.relative(context.outputDir, outputPaths.requestFile);
42
42
  context.writeFile(relativePath, content);
@@ -12822,6 +12822,7 @@ function generate$2(context) {
12822
12822
  function writeRequestValidator(templateFilePath, resourceName, operation, context) {
12823
12823
  const { operationId, request } = operation;
12824
12824
  const { body, query, param, header } = request ?? {};
12825
+ const hasRequestSchema = body !== void 0 || header !== void 0 || param !== void 0 || query !== void 0;
12825
12826
  const outputPaths = context.getOperationOutputPaths({
12826
12827
  resourceName,
12827
12828
  operationId
@@ -12838,6 +12839,7 @@ function writeRequestValidator(templateFilePath, resourceName, operation, contex
12838
12839
  query,
12839
12840
  param,
12840
12841
  header,
12842
+ hasRequestSchema,
12841
12843
  z: external_exports
12842
12844
  });
12843
12845
  const relativePath = path.relative(context.outputDir, outputPaths.requestValidationFile);
@@ -12899,7 +12901,7 @@ function createOwnResponseTemplateData(response, responseFactoryTemplateFile, co
12899
12901
  };
12900
12902
  return {
12901
12903
  ...factoryData,
12902
- body: response.body ? print(fromZod(response.body)) : void 0,
12904
+ body: response.body ? print(fromZod(response.body.schema)) : void 0,
12903
12905
  header: response.header ? print(fromZod(response.header)) : void 0,
12904
12906
  statusCode: response.statusCode,
12905
12907
  factory: renderResponseFactory(responseFactoryTemplateFile, factoryData, context, " ")
@@ -12908,7 +12910,7 @@ function createOwnResponseTemplateData(response, responseFactoryTemplateFile, co
12908
12910
  function writeCanonicalResponseType(templateFile, responseFactoryTemplateFile, response, context) {
12909
12911
  const pascalCaseName = pascalCase(response.name);
12910
12912
  const headerTsType = response.header ? print(fromZod(response.header)) : void 0;
12911
- const bodyTsType = response.body ? print(fromZod(response.body)) : void 0;
12913
+ const bodyTsType = response.body ? print(fromZod(response.body.schema)) : void 0;
12912
12914
  const factoryData = {
12913
12915
  identifierName: pascalCaseName,
12914
12916
  typeValue: response.name,