@povio/openapi-codegen-cli 3.3.0-rc.1 → 3.3.0-rc.2

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.
@@ -1,4 +1,4 @@
1
- import { h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
1
+ import { h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-SYuVswEJ.mjs";
2
2
  import path from "path";
3
3
  import SwaggerParser from "@apidevtools/swagger-parser";
4
4
  //#region src/generators/core/resolveConfig.ts
@@ -694,7 +694,7 @@ function getZodSchema({ schema, resolver, meta: inheritedMeta, tag }) {
694
694
  propZodSchema,
695
695
  isCircular
696
696
  ];
697
- }).map(([prop, propSchema, isCircular]) => isCircular ? `get ${wrapWithQuotesIfNeeded(prop)}() { return ${propSchema} }` : `${wrapWithQuotesIfNeeded(prop)}: ${propSchema}`).join(", ")} }`;
697
+ }).map(([prop, propSchema, isCircular]) => isCircular ? `${wrapWithQuotesIfNeeded(prop)}: z.lazy(() => ${propSchema})` : `${wrapWithQuotesIfNeeded(prop)}: ${propSchema}`).join(", ")} }`;
698
698
  let additionalPropsSchema = "";
699
699
  if (schema.additionalProperties) additionalPropsSchema = `.catchall(${typeof schema.additionalProperties === "object" && Object.keys(schema.additionalProperties).length > 0 ? getZodSchema({
700
700
  ...params,
@@ -3975,7 +3975,8 @@ function generateModels({ resolver, data, tag }) {
3975
3975
  const inferredTypeName = getZodSchemaInferedTypeName(name, resolver.options);
3976
3976
  if (zodSchema.isCircular && zodSchema.schemaObj) lines.push(`export type ${inferredTypeName} = ${renderSchemaType(zodSchema.schemaObj, resolver)};`);
3977
3977
  const typeAnnotation = zodSchema.isCircular ? `: z.ZodObject<z.ZodRawShape> & z.ZodType<${inferredTypeName}>` : "";
3978
- lines.push(`export const ${name}${typeAnnotation} = z.compile(${zodSchema.code});`);
3978
+ const schemaCode = zodSchema.isCircular ? zodSchema.code : `z.compile(${zodSchema.code})`;
3979
+ lines.push(`export const ${name}${typeAnnotation} = ${schemaCode};`);
3979
3980
  if (!zodSchema.isCircular) lines.push(`export type ${inferredTypeName} = z.infer<typeof ${name}>;`);
3980
3981
  if (zodSchema.isEnum) lines.push(`export const ${getZodSchemaInferedTypeName(name, resolver.options)} = ${name}.enum;`);
3981
3982
  lines.push("");
@@ -1,4 +1,4 @@
1
- import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isMediaTypeAllowed, y as isParamMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
1
+ import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isMediaTypeAllowed, y as isParamMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-SYuVswEJ.mjs";
2
2
  import SwaggerParser from "@apidevtools/swagger-parser";
3
3
  //#region src/generators/core/getMetadataFromOpenAPIDoc.ts
4
4
  async function getMetadataFromOpenAPIDoc(openApiDoc, options) {
package/dist/metro.cjs CHANGED
@@ -820,7 +820,7 @@ function getZodSchema({ schema, resolver, meta: inheritedMeta, tag }) {
820
820
  propZodSchema,
821
821
  isCircular
822
822
  ];
823
- }).map(([prop, propSchema, isCircular]) => isCircular ? `get ${wrapWithQuotesIfNeeded(prop)}() { return ${propSchema} }` : `${wrapWithQuotesIfNeeded(prop)}: ${propSchema}`).join(", ")} }`;
823
+ }).map(([prop, propSchema, isCircular]) => isCircular ? `${wrapWithQuotesIfNeeded(prop)}: z.lazy(() => ${propSchema})` : `${wrapWithQuotesIfNeeded(prop)}: ${propSchema}`).join(", ")} }`;
824
824
  let additionalPropsSchema = "";
825
825
  if (schema.additionalProperties) additionalPropsSchema = `.catchall(${typeof schema.additionalProperties === "object" && Object.keys(schema.additionalProperties).length > 0 ? getZodSchema({
826
826
  ...params,
@@ -3780,7 +3780,8 @@ function generateModels({ resolver, data, tag }) {
3780
3780
  const inferredTypeName = getZodSchemaInferedTypeName(name, resolver.options);
3781
3781
  if (zodSchema.isCircular && zodSchema.schemaObj) lines.push(`export type ${inferredTypeName} = ${renderSchemaType(zodSchema.schemaObj, resolver)};`);
3782
3782
  const typeAnnotation = zodSchema.isCircular ? `: z.ZodObject<z.ZodRawShape> & z.ZodType<${inferredTypeName}>` : "";
3783
- lines.push(`export const ${name}${typeAnnotation} = z.compile(${zodSchema.code});`);
3783
+ const schemaCode = zodSchema.isCircular ? zodSchema.code : `z.compile(${zodSchema.code})`;
3784
+ lines.push(`export const ${name}${typeAnnotation} = ${schemaCode};`);
3784
3785
  if (!zodSchema.isCircular) lines.push(`export type ${inferredTypeName} = z.infer<typeof ${name}>;`);
3785
3786
  if (zodSchema.isEnum) lines.push(`export const ${getZodSchemaInferedTypeName(name, resolver.options)} = ${name}.enum;`);
3786
3787
  lines.push("");
package/dist/metro.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-nPBssrBL.mjs";
1
+ import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-CCXQsUum.mjs";
2
2
  import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-8kCe-g9S.mjs";
3
3
  import fs from "fs";
4
4
  import path from "path";
@@ -1,5 +1,5 @@
1
- import { x as Profiler } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
2
- import { t as runGenerate } from "./generate.runner-BeCGJ1ar.mjs";
1
+ import { x as Profiler } from "./generateCodeFromOpenAPIDoc-SYuVswEJ.mjs";
2
+ import { t as runGenerate } from "./generate.runner-B0Zm3pIl.mjs";
3
3
  import path from "path";
4
4
  //#region src/plugins/openapi-codegen.runner.ts
5
5
  function createOpenApiCodegenRunner(config, options = {}) {
package/dist/sh.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { S as VALIDATION_ERROR_TYPE_TITLE, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
3
- import { n as resolveConfig, t as runGenerate } from "./generate.runner-BeCGJ1ar.mjs";
2
+ import { S as VALIDATION_ERROR_TYPE_TITLE, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-SYuVswEJ.mjs";
3
+ import { n as resolveConfig, t as runGenerate } from "./generate.runner-B0Zm3pIl.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
@@ -36,7 +36,7 @@ function logBanner(message) {
36
36
  * Fetch the version from package.json
37
37
  */
38
38
  function getVersion() {
39
- return "3.3.0-rc.1";
39
+ return "3.3.0-rc.2";
40
40
  }
41
41
  //#endregion
42
42
  //#region src/helpers/yargs.helper.ts
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-nPBssrBL.mjs";
1
+ import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-CCXQsUum.mjs";
2
2
  import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-8kCe-g9S.mjs";
3
3
  import path from "path";
4
4
  //#region src/vite/openapi-codegen.plugin.ts
package/package.json CHANGED
@@ -139,5 +139,5 @@
139
139
  "node": ">= 14"
140
140
  },
141
141
  "packageManager": "bun@1.4.0",
142
- "version": "3.3.0-rc.1"
142
+ "version": "3.3.0-rc.2"
143
143
  }