@strapi/openapi 0.0.0-experimental.4e03c41e8e44fa7b77c41c3e0edd86c7f1fc9c52 → 0.0.0-experimental.ffc36acb308febe288f1a31b62cbbb75b286585c

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.
Files changed (85) hide show
  1. package/dist/assemblers/document/factory.js +1 -1
  2. package/dist/assemblers/document/factory.mjs +1 -1
  3. package/dist/assemblers/document/info.js +1 -1
  4. package/dist/assemblers/document/info.js.map +1 -1
  5. package/dist/assemblers/document/info.mjs +1 -1
  6. package/dist/assemblers/document/info.mjs.map +1 -1
  7. package/dist/assemblers/document/metadata.js +1 -1
  8. package/dist/assemblers/document/metadata.mjs +1 -1
  9. package/dist/assemblers/document/path/factory.js +1 -1
  10. package/dist/assemblers/document/path/factory.mjs +1 -1
  11. package/dist/assemblers/document/path/path-item/factory.js +1 -1
  12. package/dist/assemblers/document/path/path-item/factory.mjs +1 -1
  13. package/dist/assemblers/document/path/path-item/operation/body.d.ts.map +1 -1
  14. package/dist/assemblers/document/path/path-item/operation/body.js.map +1 -1
  15. package/dist/assemblers/document/path/path-item/operation/body.mjs.map +1 -1
  16. package/dist/assemblers/document/path/path-item/operation/operation-id.js +1 -1
  17. package/dist/assemblers/document/path/path-item/operation/operation-id.mjs +1 -1
  18. package/dist/assemblers/document/path/path-item/operation/operation.d.ts.map +1 -1
  19. package/dist/assemblers/document/path/path-item/operation/operation.js +5 -2
  20. package/dist/assemblers/document/path/path-item/operation/operation.js.map +1 -1
  21. package/dist/assemblers/document/path/path-item/operation/operation.mjs +5 -2
  22. package/dist/assemblers/document/path/path-item/operation/operation.mjs.map +1 -1
  23. package/dist/assemblers/document/path/path-item/operation/parameters.js +2 -2
  24. package/dist/assemblers/document/path/path-item/operation/parameters.js.map +1 -1
  25. package/dist/assemblers/document/path/path-item/operation/parameters.mjs +2 -2
  26. package/dist/assemblers/document/path/path-item/operation/parameters.mjs.map +1 -1
  27. package/dist/assemblers/document/path/path-item/operation/responses.js.map +1 -1
  28. package/dist/assemblers/document/path/path-item/operation/responses.mjs.map +1 -1
  29. package/dist/assemblers/document/path/path-item/operation/tags.js +1 -1
  30. package/dist/assemblers/document/path/path-item/operation/tags.mjs +1 -1
  31. package/dist/assemblers/document/path/path-item/path-item.js +1 -1
  32. package/dist/assemblers/document/path/path-item/path-item.mjs +1 -1
  33. package/dist/assemblers/document/path/path.js +1 -1
  34. package/dist/assemblers/document/path/path.mjs +1 -1
  35. package/dist/context/factories/document.d.ts +2 -2
  36. package/dist/context/factories/document.d.ts.map +1 -1
  37. package/dist/context/factories/document.js +1 -1
  38. package/dist/context/factories/document.js.map +1 -1
  39. package/dist/context/factories/document.mjs +1 -1
  40. package/dist/context/factories/document.mjs.map +1 -1
  41. package/dist/context/factories/operation.d.ts +2 -2
  42. package/dist/context/factories/operation.d.ts.map +1 -1
  43. package/dist/context/factories/operation.js +1 -1
  44. package/dist/context/factories/operation.js.map +1 -1
  45. package/dist/context/factories/operation.mjs +1 -1
  46. package/dist/context/factories/operation.mjs.map +1 -1
  47. package/dist/context/factories/path-item.js +1 -1
  48. package/dist/context/factories/path-item.mjs +1 -1
  49. package/dist/context/factories/path.js +1 -1
  50. package/dist/context/factories/path.mjs +1 -1
  51. package/dist/exports.d.ts +27 -1
  52. package/dist/exports.d.ts.map +1 -1
  53. package/dist/exports.js +28 -1
  54. package/dist/exports.js.map +1 -1
  55. package/dist/exports.mjs +28 -1
  56. package/dist/exports.mjs.map +1 -1
  57. package/dist/generator/generator.js +1 -1
  58. package/dist/generator/generator.js.map +1 -1
  59. package/dist/generator/generator.mjs +1 -1
  60. package/dist/generator/generator.mjs.map +1 -1
  61. package/dist/generator/types.d.ts +2 -2
  62. package/dist/generator/types.d.ts.map +1 -1
  63. package/dist/post-processor/component-writer.js +21 -2
  64. package/dist/post-processor/component-writer.js.map +1 -1
  65. package/dist/post-processor/component-writer.mjs +1 -1
  66. package/dist/post-processor/component-writer.mjs.map +1 -1
  67. package/dist/registries/types.d.ts +2 -2
  68. package/dist/registries/types.d.ts.map +1 -1
  69. package/dist/routes/collector.js +1 -1
  70. package/dist/routes/collector.mjs +1 -1
  71. package/dist/routes/providers/admin.js +1 -1
  72. package/dist/routes/providers/admin.mjs +1 -1
  73. package/dist/routes/providers/api.js +1 -1
  74. package/dist/routes/providers/api.mjs +1 -1
  75. package/dist/routes/providers/plugin.js +1 -1
  76. package/dist/routes/providers/plugin.mjs +1 -1
  77. package/dist/types.d.ts +5 -5
  78. package/dist/types.d.ts.map +1 -1
  79. package/dist/utils/zod.d.ts +4 -4
  80. package/dist/utils/zod.d.ts.map +1 -1
  81. package/dist/utils/zod.js +2 -2
  82. package/dist/utils/zod.js.map +1 -1
  83. package/dist/utils/zod.mjs +2 -2
  84. package/dist/utils/zod.mjs.map +1 -1
  85. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import * as z from 'zod';
2
+ import * as z from 'zod/v4';
3
3
 
4
4
  /**
5
5
  * Converts a Zod schema to an OpenAPI Schema Object.
@@ -16,7 +16,7 @@ import * as z from 'zod';
16
16
  *
17
17
  * @example
18
18
  * ```typescript
19
- * import { z } from 'zod';
19
+ * import * as z from 'zod/v4';
20
20
  *
21
21
  * // Create a Zod schema
22
22
  * const userSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"zod.mjs","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod';\n\nimport type { OpenAPIV3 } from 'openapi-types';\n\n/**\n * Converts a Zod schema to an OpenAPI Schema Object.\n *\n * @description\n * Takes a Zod schema and converts it into an OpenAPI Schema Object (v3.1).\n * It uses a local registry to handle the conversion process and generates the appropriate\n * OpenAPI components.\n *\n * @param zodSchema - The Zod schema to convert to OpenAPI format. Can be any valid Zod schema.\n *\n * @returns An OpenAPI Schema Object representing the input Zod schema structure.\n * If the conversion cannot be completed, returns undefined.\n *\n * @example\n * ```typescript\n * import { z } from 'zod';\n *\n * // Create a Zod schema\n * const userSchema = z.object({\n * id: z.number(),\n * name: z.string(),\n * email: z.string().email()\n * });\n *\n * // Convert to OpenAPI schema\n * const openAPISchema = zodToOpenAPI(userSchema);\n * ```\n */\n\nexport const zodToOpenAPI = (\n zodSchema: z.ZodType\n): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject => {\n try {\n const id = randomUUID();\n const registry = z.registry<{ id: string }>();\n\n // Add the schema to the local registry with a custom, unique ID\n registry.add(zodSchema, { id });\n\n // Copy the global registry definitions into the local registry to make sure references are resolved\n // This prevent \"__shared\" definitions from being created\n for (const [key, value] of z.globalRegistry._idmap) {\n registry.add(value, { id: key });\n }\n\n // Generate the schemas and only return the one we want, transform the URI path to be OpenAPI compliant\n const { schemas } = z.toJSONSchema(registry, { uri: toComponentsPath });\n\n // TODO: make sure it's compliant\n return schemas[id] as OpenAPIV3.SchemaObject;\n } catch (e) {\n throw new Error(\"Couldn't transform the zod schema into an OpenAPI schema\");\n }\n};\n\n/**\n * Generates a path string for referencing a component schema by its identifier.\n *\n * @param id - The identifier of the component schema.\n * @returns The constructed path string for the specified component schema.\n */\nexport const toComponentsPath = (id: string) => `#/components/schemas/${id}`;\n"],"names":["zodToOpenAPI","zodSchema","id","randomUUID","registry","z","add","key","value","globalRegistry","_idmap","schemas","toJSONSchema","uri","toComponentsPath","e","Error"],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BaA,MAAAA,YAAAA,GAAe,CAC1BC,SAAAA,GAAAA;IAEA,IAAI;AACF,QAAA,MAAMC,EAAKC,GAAAA,UAAAA,EAAAA;QACX,MAAMC,QAAAA,GAAWC,EAAED,QAAQ,EAAA;;QAG3BA,QAASE,CAAAA,GAAG,CAACL,SAAW,EAAA;AAAEC,YAAAA;AAAG,SAAA,CAAA;;;QAI7B,KAAK,MAAM,CAACK,GAAKC,EAAAA,KAAAA,CAAM,IAAIH,CAAEI,CAAAA,cAAc,CAACC,MAAM,CAAE;YAClDN,QAASE,CAAAA,GAAG,CAACE,KAAO,EAAA;gBAAEN,EAAIK,EAAAA;AAAI,aAAA,CAAA;AAChC;;AAGA,QAAA,MAAM,EAAEI,OAAO,EAAE,GAAGN,CAAEO,CAAAA,YAAY,CAACR,QAAU,EAAA;YAAES,GAAKC,EAAAA;AAAiB,SAAA,CAAA;;QAGrE,OAAOH,OAAO,CAACT,EAAG,CAAA;AACpB,KAAA,CAAE,OAAOa,CAAG,EAAA;AACV,QAAA,MAAM,IAAIC,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;AAEA;;;;;IAMaF,MAAAA,gBAAAA,GAAmB,CAACZ,EAAAA,GAAe,CAAC,qBAAqB,EAAEA,EAAG,CAAA;;;;"}
1
+ {"version":3,"file":"zod.mjs","sources":["../../src/utils/zod.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport * as z from 'zod/v4';\n\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * Converts a Zod schema to an OpenAPI Schema Object.\n *\n * @description\n * Takes a Zod schema and converts it into an OpenAPI Schema Object (v3.1).\n * It uses a local registry to handle the conversion process and generates the appropriate\n * OpenAPI components.\n *\n * @param zodSchema - The Zod schema to convert to OpenAPI format. Can be any valid Zod schema.\n *\n * @returns An OpenAPI Schema Object representing the input Zod schema structure.\n * If the conversion cannot be completed, returns undefined.\n *\n * @example\n * ```typescript\n * import * as z from 'zod/v4';\n *\n * // Create a Zod schema\n * const userSchema = z.object({\n * id: z.number(),\n * name: z.string(),\n * email: z.string().email()\n * });\n *\n * // Convert to OpenAPI schema\n * const openAPISchema = zodToOpenAPI(userSchema);\n * ```\n */\n\nexport const zodToOpenAPI = (\n zodSchema: z.ZodType\n): OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject => {\n try {\n const id = randomUUID();\n const registry = z.registry<{ id: string }>();\n\n // Add the schema to the local registry with a custom, unique ID\n registry.add(zodSchema, { id });\n\n // Copy the global registry definitions into the local registry to make sure references are resolved\n // This prevent \"__shared\" definitions from being created\n for (const [key, value] of z.globalRegistry._idmap) {\n registry.add(value, { id: key });\n }\n\n // Generate the schemas and only return the one we want, transform the URI path to be OpenAPI compliant\n const { schemas } = z.toJSONSchema(registry, { uri: toComponentsPath });\n\n // TODO: make sure it's compliant\n return schemas[id] as OpenAPIV3_1.SchemaObject;\n } catch (e) {\n throw new Error(\"Couldn't transform the zod schema into an OpenAPI schema\");\n }\n};\n\n/**\n * Generates a path string for referencing a component schema by its identifier.\n *\n * @param id - The identifier of the component schema.\n * @returns The constructed path string for the specified component schema.\n */\nexport const toComponentsPath = (id: string) => `#/components/schemas/${id}`;\n"],"names":["zodToOpenAPI","zodSchema","id","randomUUID","registry","z","add","key","value","globalRegistry","_idmap","schemas","toJSONSchema","uri","toComponentsPath","e","Error"],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BaA,MAAAA,YAAAA,GAAe,CAC1BC,SAAAA,GAAAA;IAEA,IAAI;AACF,QAAA,MAAMC,EAAKC,GAAAA,UAAAA,EAAAA;QACX,MAAMC,QAAAA,GAAWC,EAAED,QAAQ,EAAA;;QAG3BA,QAASE,CAAAA,GAAG,CAACL,SAAW,EAAA;AAAEC,YAAAA;AAAG,SAAA,CAAA;;;QAI7B,KAAK,MAAM,CAACK,GAAKC,EAAAA,KAAAA,CAAM,IAAIH,CAAEI,CAAAA,cAAc,CAACC,MAAM,CAAE;YAClDN,QAASE,CAAAA,GAAG,CAACE,KAAO,EAAA;gBAAEN,EAAIK,EAAAA;AAAI,aAAA,CAAA;AAChC;;AAGA,QAAA,MAAM,EAAEI,OAAO,EAAE,GAAGN,CAAEO,CAAAA,YAAY,CAACR,QAAU,EAAA;YAAES,GAAKC,EAAAA;AAAiB,SAAA,CAAA;;QAGrE,OAAOH,OAAO,CAACT,EAAG,CAAA;AACpB,KAAA,CAAE,OAAOa,CAAG,EAAA;AACV,QAAA,MAAM,IAAIC,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;AAEA;;;;;IAMaF,MAAAA,gBAAAA,GAAmB,CAACZ,EAAAA,GAAe,CAAC,qBAAqB,EAAEA,EAAG,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/openapi",
3
- "version": "0.0.0-experimental.4e03c41e8e44fa7b77c41c3e0edd86c7f1fc9c52",
3
+ "version": "0.0.0-experimental.ffc36acb308febe288f1a31b62cbbb75b286585c",
4
4
  "description": "A tool set to help generate and validate API documentation for Strapi projects",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -56,13 +56,13 @@
56
56
  "npm": ">=6.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@strapi/types": "0.0.0-experimental.4e03c41e8e44fa7b77c41c3e0edd86c7f1fc9c52",
59
+ "@strapi/types": "0.0.0-experimental.ffc36acb308febe288f1a31b62cbbb75b286585c",
60
60
  "debug": "4.3.4",
61
61
  "openapi-types": "12.1.3",
62
- "zod": "next"
62
+ "zod": "3.25.67"
63
63
  },
64
64
  "devDependencies": {
65
- "@strapi/types": "5.13.0",
65
+ "@strapi/types": "5.19.0",
66
66
  "@types/debug": "^4"
67
67
  }
68
68
  }