@kattebak/openapi-generator-ts 1.0.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.
Files changed (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/dist/cli/commands/generate.d.ts +23 -0
  4. package/dist/cli/commands/generate.d.ts.map +1 -0
  5. package/dist/cli/commands/generate.js +116 -0
  6. package/dist/cli/commands/generate.js.map +1 -0
  7. package/dist/cli/commands/list.d.ts +2 -0
  8. package/dist/cli/commands/list.d.ts.map +1 -0
  9. package/dist/cli/commands/list.js +26 -0
  10. package/dist/cli/commands/list.js.map +1 -0
  11. package/dist/cli/commands/validate.d.ts +6 -0
  12. package/dist/cli/commands/validate.d.ts.map +1 -0
  13. package/dist/cli/commands/validate.js +80 -0
  14. package/dist/cli/commands/validate.js.map +1 -0
  15. package/dist/cli/convert-template.d.ts +31 -0
  16. package/dist/cli/convert-template.d.ts.map +1 -0
  17. package/dist/cli/convert-template.js +204 -0
  18. package/dist/cli/convert-template.js.map +1 -0
  19. package/dist/cli/convert-template.test.d.ts +2 -0
  20. package/dist/cli/convert-template.test.d.ts.map +1 -0
  21. package/dist/cli/convert-template.test.js +74 -0
  22. package/dist/cli/convert-template.test.js.map +1 -0
  23. package/dist/cli/index.d.ts +3 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +246 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/core/config.d.ts +252 -0
  28. package/dist/core/config.d.ts.map +1 -0
  29. package/dist/core/config.js +31 -0
  30. package/dist/core/config.js.map +1 -0
  31. package/dist/core/generator.d.ts +99 -0
  32. package/dist/core/generator.d.ts.map +1 -0
  33. package/dist/core/generator.js +492 -0
  34. package/dist/core/generator.js.map +1 -0
  35. package/dist/core/index.d.ts +4 -0
  36. package/dist/core/index.d.ts.map +1 -0
  37. package/dist/core/index.js +4 -0
  38. package/dist/core/index.js.map +1 -0
  39. package/dist/core/types.d.ts +47 -0
  40. package/dist/core/types.d.ts.map +1 -0
  41. package/dist/core/types.js +5 -0
  42. package/dist/core/types.js.map +1 -0
  43. package/dist/generators/generators.test.d.ts +6 -0
  44. package/dist/generators/generators.test.d.ts.map +1 -0
  45. package/dist/generators/generators.test.js +247 -0
  46. package/dist/generators/generators.test.js.map +1 -0
  47. package/dist/generators/go.d.ts +10 -0
  48. package/dist/generators/go.d.ts.map +1 -0
  49. package/dist/generators/go.js +327 -0
  50. package/dist/generators/go.js.map +1 -0
  51. package/dist/generators/index.d.ts +29 -0
  52. package/dist/generators/index.d.ts.map +1 -0
  53. package/dist/generators/index.js +58 -0
  54. package/dist/generators/index.js.map +1 -0
  55. package/dist/generators/php.d.ts +14 -0
  56. package/dist/generators/php.d.ts.map +1 -0
  57. package/dist/generators/php.js +241 -0
  58. package/dist/generators/php.js.map +1 -0
  59. package/dist/generators/python.d.ts +10 -0
  60. package/dist/generators/python.d.ts.map +1 -0
  61. package/dist/generators/python.js +273 -0
  62. package/dist/generators/python.js.map +1 -0
  63. package/dist/generators/typescript-fetch.d.ts +14 -0
  64. package/dist/generators/typescript-fetch.d.ts.map +1 -0
  65. package/dist/generators/typescript-fetch.js +217 -0
  66. package/dist/generators/typescript-fetch.js.map +1 -0
  67. package/dist/index.d.ts +14 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +16 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/models/codegen-model.d.ts +123 -0
  72. package/dist/models/codegen-model.d.ts.map +1 -0
  73. package/dist/models/codegen-model.js +64 -0
  74. package/dist/models/codegen-model.js.map +1 -0
  75. package/dist/models/codegen-model.test.d.ts +6 -0
  76. package/dist/models/codegen-model.test.d.ts.map +1 -0
  77. package/dist/models/codegen-model.test.js +143 -0
  78. package/dist/models/codegen-model.test.js.map +1 -0
  79. package/dist/models/codegen-operation.d.ts +95 -0
  80. package/dist/models/codegen-operation.d.ts.map +1 -0
  81. package/dist/models/codegen-operation.js +54 -0
  82. package/dist/models/codegen-operation.js.map +1 -0
  83. package/dist/models/codegen-parameter.d.ts +86 -0
  84. package/dist/models/codegen-parameter.d.ts.map +1 -0
  85. package/dist/models/codegen-parameter.js +47 -0
  86. package/dist/models/codegen-parameter.js.map +1 -0
  87. package/dist/models/codegen-property.d.ts +95 -0
  88. package/dist/models/codegen-property.d.ts.map +1 -0
  89. package/dist/models/codegen-property.js +47 -0
  90. package/dist/models/codegen-property.js.map +1 -0
  91. package/dist/models/codegen-response.d.ts +64 -0
  92. package/dist/models/codegen-response.d.ts.map +1 -0
  93. package/dist/models/codegen-response.js +42 -0
  94. package/dist/models/codegen-response.js.map +1 -0
  95. package/dist/models/codegen-security.d.ts +34 -0
  96. package/dist/models/codegen-security.d.ts.map +1 -0
  97. package/dist/models/codegen-security.js +18 -0
  98. package/dist/models/codegen-security.js.map +1 -0
  99. package/dist/models/index.d.ts +8 -0
  100. package/dist/models/index.d.ts.map +1 -0
  101. package/dist/models/index.js +7 -0
  102. package/dist/models/index.js.map +1 -0
  103. package/dist/parser/index.d.ts +4 -0
  104. package/dist/parser/index.d.ts.map +1 -0
  105. package/dist/parser/index.js +4 -0
  106. package/dist/parser/index.js.map +1 -0
  107. package/dist/parser/openapi-parser.d.ts +71 -0
  108. package/dist/parser/openapi-parser.d.ts.map +1 -0
  109. package/dist/parser/openapi-parser.js +195 -0
  110. package/dist/parser/openapi-parser.js.map +1 -0
  111. package/dist/parser/openapi-parser.test.d.ts +6 -0
  112. package/dist/parser/openapi-parser.test.d.ts.map +1 -0
  113. package/dist/parser/openapi-parser.test.js +238 -0
  114. package/dist/parser/openapi-parser.test.js.map +1 -0
  115. package/dist/parser/operation-transformer.d.ts +95 -0
  116. package/dist/parser/operation-transformer.d.ts.map +1 -0
  117. package/dist/parser/operation-transformer.js +634 -0
  118. package/dist/parser/operation-transformer.js.map +1 -0
  119. package/dist/parser/schema-transformer.d.ts +134 -0
  120. package/dist/parser/schema-transformer.d.ts.map +1 -0
  121. package/dist/parser/schema-transformer.js +557 -0
  122. package/dist/parser/schema-transformer.js.map +1 -0
  123. package/dist/template/engine-adapter.d.ts +55 -0
  124. package/dist/template/engine-adapter.d.ts.map +1 -0
  125. package/dist/template/engine-adapter.js +178 -0
  126. package/dist/template/engine-adapter.js.map +1 -0
  127. package/dist/template/engine-adapter.test.d.ts +6 -0
  128. package/dist/template/engine-adapter.test.d.ts.map +1 -0
  129. package/dist/template/engine-adapter.test.js +186 -0
  130. package/dist/template/engine-adapter.test.js.map +1 -0
  131. package/dist/template/index.d.ts +5 -0
  132. package/dist/template/index.d.ts.map +1 -0
  133. package/dist/template/index.js +5 -0
  134. package/dist/template/index.js.map +1 -0
  135. package/dist/template/lambdas/indent-lambdas.d.ts +40 -0
  136. package/dist/template/lambdas/indent-lambdas.d.ts.map +1 -0
  137. package/dist/template/lambdas/indent-lambdas.js +98 -0
  138. package/dist/template/lambdas/indent-lambdas.js.map +1 -0
  139. package/dist/template/lambdas/index.d.ts +44 -0
  140. package/dist/template/lambdas/index.d.ts.map +1 -0
  141. package/dist/template/lambdas/index.js +79 -0
  142. package/dist/template/lambdas/index.js.map +1 -0
  143. package/dist/template/lambdas/string-lambdas.d.ts +78 -0
  144. package/dist/template/lambdas/string-lambdas.d.ts.map +1 -0
  145. package/dist/template/lambdas/string-lambdas.js +148 -0
  146. package/dist/template/lambdas/string-lambdas.js.map +1 -0
  147. package/dist/template/lambdas/string-lambdas.test.d.ts +6 -0
  148. package/dist/template/lambdas/string-lambdas.test.d.ts.map +1 -0
  149. package/dist/template/lambdas/string-lambdas.test.js +158 -0
  150. package/dist/template/lambdas/string-lambdas.test.js.map +1 -0
  151. package/dist/template/template-locator.d.ts +72 -0
  152. package/dist/template/template-locator.d.ts.map +1 -0
  153. package/dist/template/template-locator.js +173 -0
  154. package/dist/template/template-locator.js.map +1 -0
  155. package/dist/template/template-manager.d.ts +65 -0
  156. package/dist/template/template-manager.d.ts.map +1 -0
  157. package/dist/template/template-manager.js +185 -0
  158. package/dist/template/template-manager.js.map +1 -0
  159. package/package.json +67 -0
  160. package/templates/go/.travis.yml +8 -0
  161. package/templates/go/README.mustache +236 -0
  162. package/templates/go/api.mustache +452 -0
  163. package/templates/go/api_doc.mustache +92 -0
  164. package/templates/go/api_test.mustache +59 -0
  165. package/templates/go/client.mustache +761 -0
  166. package/templates/go/configuration.mustache +332 -0
  167. package/templates/go/git_push.sh.mustache +57 -0
  168. package/templates/go/gitignore.mustache +24 -0
  169. package/templates/go/go.mod.mustache +16 -0
  170. package/templates/go/go.sum.mustache +19 -0
  171. package/templates/go/model.mustache +21 -0
  172. package/templates/go/model_anyof.mustache +93 -0
  173. package/templates/go/model_doc.mustache +97 -0
  174. package/templates/go/model_enum.mustache +101 -0
  175. package/templates/go/model_oneof.mustache +160 -0
  176. package/templates/go/model_simple.mustache +572 -0
  177. package/templates/go/nullable_model.mustache +35 -0
  178. package/templates/go/openapi.mustache +1 -0
  179. package/templates/go/partial_header.mustache +18 -0
  180. package/templates/go/response.mustache +38 -0
  181. package/templates/go/signing.mustache +453 -0
  182. package/templates/go/utils.mustache +352 -0
  183. package/templates/php/.php-cs-fixer.dist.php +29 -0
  184. package/templates/php/.travis.yml +8 -0
  185. package/templates/php/ApiException.mustache +111 -0
  186. package/templates/php/Configuration.mustache +606 -0
  187. package/templates/php/FormDataProcessor.mustache +238 -0
  188. package/templates/php/HeaderSelector.mustache +265 -0
  189. package/templates/php/ModelInterface.mustache +103 -0
  190. package/templates/php/ObjectSerializer.mustache +591 -0
  191. package/templates/php/README.mustache +151 -0
  192. package/templates/php/api.mustache +891 -0
  193. package/templates/php/api_doc.mustache +105 -0
  194. package/templates/php/api_test.mustache +80 -0
  195. package/templates/php/composer.mustache +44 -0
  196. package/templates/php/git_push.sh.mustache +57 -0
  197. package/templates/php/gitignore +15 -0
  198. package/templates/php/libraries/psr-18/ApiException.mustache +114 -0
  199. package/templates/php/libraries/psr-18/DebugPlugin.mustache +93 -0
  200. package/templates/php/libraries/psr-18/README.mustache +161 -0
  201. package/templates/php/libraries/psr-18/api.mustache +833 -0
  202. package/templates/php/libraries/psr-18/api_doc.mustache +79 -0
  203. package/templates/php/libraries/psr-18/composer.mustache +56 -0
  204. package/templates/php/model.mustache +47 -0
  205. package/templates/php/model_doc.mustache +10 -0
  206. package/templates/php/model_enum.mustache +33 -0
  207. package/templates/php/model_generic.mustache +565 -0
  208. package/templates/php/model_test.mustache +88 -0
  209. package/templates/php/partial_header.mustache +18 -0
  210. package/templates/php/php_doc_auth_partial.mustache +23 -0
  211. package/templates/php/phpunit.xml.mustache +18 -0
  212. package/templates/python/README.mustache +60 -0
  213. package/templates/python/README_onlypackage.mustache +50 -0
  214. package/templates/python/__init__.mustache +1 -0
  215. package/templates/python/__init__api.mustache +19 -0
  216. package/templates/python/__init__model.mustache +22 -0
  217. package/templates/python/__init__package.mustache +49 -0
  218. package/templates/python/api.mustache +244 -0
  219. package/templates/python/api_client.mustache +822 -0
  220. package/templates/python/api_doc.mustache +81 -0
  221. package/templates/python/api_doc_example.mustache +38 -0
  222. package/templates/python/api_response.mustache +21 -0
  223. package/templates/python/api_test.mustache +48 -0
  224. package/templates/python/asyncio/rest.mustache +209 -0
  225. package/templates/python/common_README.mustache +85 -0
  226. package/templates/python/configuration.mustache +806 -0
  227. package/templates/python/exceptions.mustache +210 -0
  228. package/templates/python/exports_api.mustache +3 -0
  229. package/templates/python/exports_model.mustache +3 -0
  230. package/templates/python/exports_package.mustache +20 -0
  231. package/templates/python/git_push.sh.mustache +57 -0
  232. package/templates/python/github-workflow.mustache +35 -0
  233. package/templates/python/gitignore.mustache +66 -0
  234. package/templates/python/gitlab-ci.mustache +31 -0
  235. package/templates/python/httpx/rest.mustache +190 -0
  236. package/templates/python/model.mustache +16 -0
  237. package/templates/python/model_anyof.mustache +182 -0
  238. package/templates/python/model_doc.mustache +40 -0
  239. package/templates/python/model_enum.mustache +36 -0
  240. package/templates/python/model_generic.mustache +403 -0
  241. package/templates/python/model_oneof.mustache +209 -0
  242. package/templates/python/model_test.mustache +60 -0
  243. package/templates/python/partial_api.mustache +52 -0
  244. package/templates/python/partial_api_args.mustache +18 -0
  245. package/templates/python/partial_header.mustache +19 -0
  246. package/templates/python/py.typed.mustache +1 -0
  247. package/templates/python/pyproject.mustache +172 -0
  248. package/templates/python/python_doc_auth_partial.mustache +108 -0
  249. package/templates/python/requirements.mustache +23 -0
  250. package/templates/python/rest.mustache +254 -0
  251. package/templates/python/setup.mustache +60 -0
  252. package/templates/python/setup_cfg.mustache +2 -0
  253. package/templates/python/signing.mustache +422 -0
  254. package/templates/python/test-requirements.mustache +6 -0
  255. package/templates/python/tornado/rest.mustache +148 -0
  256. package/templates/python/tox.mustache +9 -0
  257. package/templates/python/travis.mustache +17 -0
  258. package/templates/typescript-fetch/ApiEntitiesRecord.mustache +26 -0
  259. package/templates/typescript-fetch/ApiEntitiesReducer.mustache +21 -0
  260. package/templates/typescript-fetch/ApiEntitiesSelectors.mustache +5 -0
  261. package/templates/typescript-fetch/README.mustache +127 -0
  262. package/templates/typescript-fetch/allSagas.mustache +19 -0
  263. package/templates/typescript-fetch/api_doc.mustache +63 -0
  264. package/templates/typescript-fetch/api_example.mustache +44 -0
  265. package/templates/typescript-fetch/apis.index.mustache +16 -0
  266. package/templates/typescript-fetch/apis.mustache +483 -0
  267. package/templates/typescript-fetch/apisAssignQueryParam.mustache +12 -0
  268. package/templates/typescript-fetch/gitignore +4 -0
  269. package/templates/typescript-fetch/index.mustache +17 -0
  270. package/templates/typescript-fetch/licenseInfo.mustache +11 -0
  271. package/templates/typescript-fetch/modelEnum.mustache +28 -0
  272. package/templates/typescript-fetch/modelEnumInterfaces.mustache +37 -0
  273. package/templates/typescript-fetch/modelGeneric.mustache +261 -0
  274. package/templates/typescript-fetch/modelGenericInterfaces.mustache +50 -0
  275. package/templates/typescript-fetch/modelOneOf.mustache +255 -0
  276. package/templates/typescript-fetch/modelOneOfInterfaces.mustache +6 -0
  277. package/templates/typescript-fetch/model_doc.mustache +41 -0
  278. package/templates/typescript-fetch/models.index.mustache +32 -0
  279. package/templates/typescript-fetch/models.mustache +24 -0
  280. package/templates/typescript-fetch/npmignore.mustache +1 -0
  281. package/templates/typescript-fetch/package.mustache +43 -0
  282. package/templates/typescript-fetch/recordGeneric.mustache +295 -0
  283. package/templates/typescript-fetch/records.mustache +17 -0
  284. package/templates/typescript-fetch/runtime.mustache +424 -0
  285. package/templates/typescript-fetch/runtimeSagasAndRecords.mustache +120 -0
  286. package/templates/typescript-fetch/sagaApiManager.mustache +28 -0
  287. package/templates/typescript-fetch/sagas.mustache +245 -0
  288. package/templates/typescript-fetch/sourceLibraryIndex.mustache +1 -0
  289. package/templates/typescript-fetch/tsconfig.esm.mustache +7 -0
  290. package/templates/typescript-fetch/tsconfig.mustache +25 -0
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Mustache to Handlebars Template Converter
4
+ *
5
+ * Converts OpenAPI Generator Mustache templates to Handlebars-compatible format.
6
+ *
7
+ * Handlebars is largely compatible with Mustache, but there are a few key differences:
8
+ *
9
+ * 1. Delimiter changes ({{=<% %>=}}) are NOT supported in Handlebars
10
+ * - These are converted to helper calls or removed
11
+ *
12
+ * 2. The {{#lambda.xxx}}...{{/lambda.xxx}} pattern becomes {{#xxx}}...{{/xxx}}
13
+ * - Lambda helpers are registered in the engine adapter
14
+ *
15
+ * 3. Array index access like foo.0.bar needs bracket notation: foo.[0].bar
16
+ * - Handlebars requires this for numeric keys
17
+ *
18
+ * Most other Mustache syntax works identically in Handlebars:
19
+ * - {{var}} - escaped output
20
+ * - {{{var}}} - unescaped output
21
+ * - {{#section}}...{{/section}} - block sections
22
+ * - {{^inverted}}...{{/inverted}} - inverted sections
23
+ * - {{>partial}} - partials
24
+ * - {{!comment}} - comments
25
+ */
26
+ import { readFileSync } from "node:fs";
27
+ /**
28
+ * Convert a Mustache template to Handlebars-compatible format
29
+ * Uses simple regex-based transformations for reliability
30
+ */
31
+ export function convertTemplate(content) {
32
+ let result = content;
33
+ // 1. Handle delimiter-change pattern for JSDoc types
34
+ // Pattern: {{=<% %>=}}{<%&varname%>}<%={{ }}=%>
35
+ // This outputs literal { } around a variable value
36
+ // Convert to: {{braceWrap varname}}
37
+ result = result.replace(/\{\{=<% %>=\}\}\{<%&(\w+)%>\}<%=\{\{ \}\}=%>/g, "{{braceWrap $1}}");
38
+ // 2. Handle delimiter-change pattern for @param tags (similar but with different context)
39
+ // Pattern: {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
40
+ // Already covered by the above regex
41
+ // 3. Remove any remaining standalone delimiter changes
42
+ // These switch delimiters but the tokenizer should handle them
43
+ // {{=<% %>=}} or <%={{ }}=%>
44
+ result = result.replace(/\{\{=<% %>=\}\}/g, "");
45
+ result = result.replace(/<%=\{\{ \}\}=%>/g, "");
46
+ // 4. Handle any remaining alternate delimiter variables that weren't part of the pattern
47
+ // <%varname%> -> {{varname}}
48
+ result = result.replace(/<%(\w+)%>/g, "{{$1}}");
49
+ // <%&varname%> -> {{{varname}}}
50
+ result = result.replace(/<%&(\w+)%>/g, "{{{$1}}}");
51
+ // Handle alternate delimiter block helpers
52
+ // <%#section%> -> {{#section}}
53
+ result = result.replace(/<%#([\w-]+)%>/g, "{{#$1}}");
54
+ // <%/section%> -> {{/$1}}
55
+ result = result.replace(/<%\/([\w-]+)%>/g, "{{/$1}}");
56
+ // <%^inverted%> -> {{^inverted}}
57
+ result = result.replace(/<%\^([\w-]+)%>/g, "{{^$1}}");
58
+ // 5. Convert lambda block helpers: {{#lambda.xxx}} -> {{#xxx}}
59
+ result = result.replace(/\{\{#lambda\.(\w+)\}\}/g, "{{#$1}}");
60
+ result = result.replace(/\{\{\/lambda\.(\w+)\}\}/g, "{{/$1}}");
61
+ // 6. Convert lambda inline helpers: {{lambda.xxx arg}} -> {{xxx arg}}
62
+ // This handles cases like {{lambda.lowercase name}}
63
+ result = result.replace(/\{\{lambda\.(\w+)\s+/g, "{{$1 ");
64
+ // 7. Convert array index access: foo.0.bar -> foo.[0].bar
65
+ // Look for patterns like .0. or .0}} or .0}}}
66
+ result = result.replace(/\.(\d+)\./g, ".[$1].");
67
+ result = result.replace(/\.(\d+)\}\}/g, ".[$1]}}");
68
+ result = result.replace(/\.(\d+)\}\}\}/g, ".[$1]}}}");
69
+ // 8. Convert array-as-boolean check: {{#varname.[0]}}...{{/varname.[0]}}
70
+ // In Mustache, this enters a block if the first element exists but context is still parent.
71
+ // In Handlebars, the context changes to the first element, breaking inner {{#varname}} refs.
72
+ // Convert to {{#if varname}}...{{/if}} which preserves context and checks array truthiness.
73
+ // Also handle the inverted version {{^varname.[0]}}...{{/varname.[0]}}
74
+ result = result.replace(/\{\{#(\w+)\.\[0\]\}\}/g, "{{#if $1}}");
75
+ result = result.replace(/\{\{\/(\w+)\.\[0\]\}\}/g, "{{/if}}");
76
+ result = result.replace(/\{\{\^(\w+)\.\[0\]\}\}/g, "{{#unless $1}}");
77
+ // 9. Convert string-as-boolean sections to {{#if}} blocks
78
+ // In Mustache, {{#stringVar}}...{{/stringVar}} checks truthiness but keeps parent context.
79
+ // In Handlebars, it changes context to the string value, breaking sibling variable access.
80
+ // Convert known string variables to {{#if}} to preserve context.
81
+ //
82
+ // Note: Both {{#var}} and {{^var}} use {{/var}} as closing in Mustache.
83
+ // In Handlebars, we need {{/if}} for {{#if}} and {{/unless}} for {{#unless}}.
84
+ // So we process inverted sections first as complete pairs, then process normal sections.
85
+ const stringVars = [
86
+ "returnType",
87
+ "returnBaseType",
88
+ "summary",
89
+ "notes",
90
+ "description",
91
+ "unescapedDescription",
92
+ "externalDocsDescription",
93
+ "externalDocsUrl",
94
+ "basePath",
95
+ "host",
96
+ "title",
97
+ "appDescription",
98
+ "appDescriptionWithNewLines",
99
+ "appName",
100
+ "infoUrl",
101
+ "infoEmail",
102
+ "version",
103
+ "termsOfService",
104
+ "licenseName",
105
+ "licenseUrl",
106
+ "licenseInfo",
107
+ "appContact",
108
+ "returnContainer",
109
+ "defaultValue",
110
+ "dataFormat",
111
+ "example",
112
+ "exampleValue",
113
+ // Note: bodyParam is an object, NOT a string - do not add here
114
+ // Note: vendorExtensions is also an object
115
+ "pattern",
116
+ "minimum",
117
+ "maximum",
118
+ "minLength",
119
+ "maxLength",
120
+ ];
121
+ for (const varName of stringVars) {
122
+ // First, handle the special case where {{{.}}} or {{.}} is used inside the block
123
+ // This pattern is common in Mustache: {{#varName}}{{{.}}}{{/varName}}
124
+ // The . refers to the current context (the varName value)
125
+ // Convert to: {{{varName}}} directly
126
+ result = result.replace(new RegExp(`\\{\\{#${varName}\\}\\}\\{\\{\\{\\.\\}\\}\\}\\{\\{/${varName}\\}\\}`, "g"), `{{{${varName}}}}`);
127
+ result = result.replace(new RegExp(`\\{\\{#${varName}\\}\\}\\{\\{\\.\\}\\}\\{\\{/${varName}\\}\\}`, "g"), `{{${varName}}}`);
128
+ // Handle patterns with surrounding text: {{#varName}}prefix {{{.}}} suffix{{/varName}}
129
+ // Convert to: {{#if varName}}prefix {{{varName}}} suffix{{/if}}
130
+ result = result.replace(new RegExp(`\\{\\{#${varName}\\}\\}([^{]*)\\{\\{\\{\\.\\}\\}\\}([^{]*)\\{\\{/${varName}\\}\\}`, "g"), `{{#if ${varName}}}$1{{{${varName}}}}$2{{/if}}`);
131
+ result = result.replace(new RegExp(`\\{\\{#${varName}\\}\\}([^{]*)\\{\\{\\.\\}\\}([^{]*)\\{\\{/${varName}\\}\\}`, "g"), `{{#if ${varName}}}$1{{${varName}}}$2{{/if}}`);
132
+ // Then convert inverted sections as complete pairs
133
+ // {{^varName}}...{{/varName}} -> {{#unless varName}}...{{/unless}}
134
+ // Use non-greedy match to handle nested sections correctly
135
+ result = result.replace(new RegExp(`\\{\\{\\^${varName}\\}\\}([\\s\\S]*?)\\{\\{/${varName}\\}\\}`, "g"), `{{#unless ${varName}}}$1{{/unless}}`);
136
+ // Then convert remaining normal sections with dot reference replacement
137
+ // {{#varName}}...{{{.}}}...{{/varName}} -> {{#if varName}}...{{{varName}}}...{{/if}}
138
+ // We need to replace {{{.}}} and {{.}} with the varName inside the block
139
+ // Run iteratively because nested blocks need multiple passes
140
+ let prevResult = "";
141
+ while (prevResult !== result) {
142
+ prevResult = result;
143
+ result = result.replace(new RegExp(`\\{\\{#${varName}\\}\\}([\\s\\S]*?)\\{\\{/${varName}\\}\\}`, "g"), (_, content) => {
144
+ // Replace dot references with the variable name inside the block
145
+ const replaced = content
146
+ .replace(/\{\{\{\.\}\}\}/g, `{{{${varName}}}}`)
147
+ .replace(/\{\{\.\}\}/g, `{{${varName}}}`);
148
+ return `{{#if ${varName}}}${replaced}{{/if}}`;
149
+ });
150
+ }
151
+ }
152
+ // 10. Handle -first and -last in iteration contexts
153
+ // Process inverted sections FIRST as complete pairs (they use {{/-first}} as close tag too)
154
+ // {{^-first}}...{{/-first}} -> {{#unless @first}}...{{/unless}}
155
+ result = result.replace(/\{\{\^-first\}\}([\s\S]*?)\{\{\/-first\}\}/g, "{{#unless @first}}$1{{/unless}}");
156
+ result = result.replace(/\{\{\^-last\}\}([\s\S]*?)\{\{\/-last\}\}/g, "{{#unless @last}}$1{{/unless}}");
157
+ // Then process regular sections
158
+ // {{#-first}}...{{/-first}} -> {{#if @first}}...{{/if}}
159
+ result = result.replace(/\{\{#-first\}\}/g, "{{#if @first}}");
160
+ result = result.replace(/\{\{\/-first\}\}/g, "{{/if}}");
161
+ result = result.replace(/\{\{#-last\}\}/g, "{{#if @last}}");
162
+ result = result.replace(/\{\{\/-last\}\}/g, "{{/if}}");
163
+ // 11. Fix ambiguous }}} sequences after block tags that could confuse Handlebars
164
+ // When a block tag like {{#if ...}} or {{/if}} is followed immediately by }
165
+ // (which is code output, not template), Handlebars parser may get confused.
166
+ // Add whitespace to disambiguate: {{#if foo}}} -> {{#if foo}} }
167
+ // Pattern: Match {{...}} where ... doesn't start with { (not unescaped output)
168
+ // followed by } that isn't part of another tag
169
+ result = result.replace(/(\{\{[#^/][\w@\s]+\}\})\}([^}])/g, "$1 }$2");
170
+ return result;
171
+ }
172
+ /**
173
+ * Process a single file - reads from path, outputs converted content to stdout
174
+ */
175
+ function processFile(inputPath) {
176
+ const content = readFileSync(inputPath, "utf-8");
177
+ const converted = convertTemplate(content);
178
+ process.stdout.write(converted);
179
+ }
180
+ // CLI handling
181
+ function main() {
182
+ const args = process.argv.slice(2);
183
+ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
184
+ console.log(`
185
+ Mustache to Handlebars Template Converter
186
+
187
+ Usage:
188
+ npx tsx src/cli/convert-template.ts <input-file>
189
+
190
+ The converted template is written to stdout.
191
+
192
+ Examples:
193
+ npx tsx src/cli/convert-template.ts template.mustache
194
+ npx tsx src/cli/convert-template.ts template.mustache > output.mustache
195
+ `);
196
+ process.exit(0);
197
+ }
198
+ processFile(args[0]);
199
+ }
200
+ // Run if called directly
201
+ if (import.meta.url === `file://${process.argv[1]}`) {
202
+ main();
203
+ }
204
+ //# sourceMappingURL=convert-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-template.js","sourceRoot":"","sources":["../../src/cli/convert-template.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,IAAI,MAAM,GAAG,OAAO,CAAC;IAErB,qDAAqD;IACrD,gDAAgD;IAChD,mDAAmD;IACnD,oCAAoC;IACpC,MAAM,GAAG,MAAM,CAAC,OAAO,CACtB,+CAA+C,EAC/C,kBAAkB,CAClB,CAAC;IAEF,0FAA0F;IAC1F,iDAAiD;IACjD,qCAAqC;IAErC,uDAAuD;IACvD,+DAA+D;IAC/D,6BAA6B;IAC7B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAChD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAEhD,yFAAyF;IACzF,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@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=convert-template.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-template.test.d.ts","sourceRoot":"","sources":["../../src/cli/convert-template.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,74 @@
1
+ import assert from "node:assert";
2
+ import { describe, it } from "node:test";
3
+ import { convertTemplate } from "./convert-template.js";
4
+ describe("Template Converter", () => {
5
+ describe("convertTemplate", () => {
6
+ it("should pass through simple variables", () => {
7
+ const result = convertTemplate("{{name}}");
8
+ assert.strictEqual(result, "{{name}}");
9
+ });
10
+ it("should pass through triple mustache", () => {
11
+ const result = convertTemplate("{{{html}}}");
12
+ assert.strictEqual(result, "{{{html}}}");
13
+ });
14
+ it("should pass through sections", () => {
15
+ const result = convertTemplate("{{#items}}{{name}}{{/items}}");
16
+ assert.strictEqual(result, "{{#items}}{{name}}{{/items}}");
17
+ });
18
+ it("should convert delimiter-change JSDoc pattern", () => {
19
+ const input = "* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>";
20
+ const result = convertTemplate(input);
21
+ assert.strictEqual(result, "* @type {{braceWrap datatype}}");
22
+ });
23
+ it("should convert lambda block helpers", () => {
24
+ const input = "{{#lambda.camelcase}}someName{{/lambda.camelcase}}";
25
+ const result = convertTemplate(input);
26
+ assert.strictEqual(result, "{{#camelcase}}someName{{/camelcase}}");
27
+ });
28
+ it("should convert lambda inline helpers", () => {
29
+ const input = "{{lambda.lowercase name}}";
30
+ const result = convertTemplate(input);
31
+ assert.strictEqual(result, "{{lowercase name}}");
32
+ });
33
+ it("should convert array index access", () => {
34
+ const input = "{{items.0.name}}";
35
+ const result = convertTemplate(input);
36
+ assert.strictEqual(result, "{{items.[0].name}}");
37
+ });
38
+ it("should handle -first and -last in iterations", () => {
39
+ const input = "{{#-first}}First{{/-first}}{{#-last}}Last{{/-last}}";
40
+ const result = convertTemplate(input);
41
+ assert.strictEqual(result, "{{#if @first}}First{{/if}}{{#if @last}}Last{{/if}}");
42
+ });
43
+ it("should handle inverted -first", () => {
44
+ const input = "{{^-first}}, {{/-first}}";
45
+ const result = convertTemplate(input);
46
+ assert.strictEqual(result, "{{#unless @first}}, {{/unless}}");
47
+ });
48
+ it("should remove standalone delimiter changes", () => {
49
+ const input = "before{{=<% %>=}}after";
50
+ const result = convertTemplate(input);
51
+ assert.strictEqual(result, "beforeafter");
52
+ });
53
+ it("should convert remaining alternate delimiter variables", () => {
54
+ const input = "{{=<% %>=}}<%name%><%={{ }}=%>";
55
+ const result = convertTemplate(input);
56
+ assert.strictEqual(result, "{{name}}");
57
+ });
58
+ it("should convert remaining alternate delimiter unescaped", () => {
59
+ const input = "{{=<% %>=}}<%&html%><%={{ }}=%>";
60
+ const result = convertTemplate(input);
61
+ assert.strictEqual(result, "{{{html}}}");
62
+ });
63
+ it("should handle complex real-world template", () => {
64
+ const input = `/**
65
+ * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{paramName}} {{description}}
66
+ */`;
67
+ const result = convertTemplate(input);
68
+ assert.strictEqual(result, `/**
69
+ * @param {{braceWrap dataType}} {{paramName}} {{description}}
70
+ */`);
71
+ });
72
+ });
73
+ });
74
+ //# sourceMappingURL=convert-template.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-template.test.js","sourceRoot":"","sources":["../../src/cli/convert-template.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC/C,MAAM,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,CAAC,WAAW,CAA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AC,2CAA2C,EAAE,GAAG,EAAE;YACpD,MAAM,KAAK,GAAG;;IAEb,CAAC;YACF,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,WAAW,CACjB,MAAM,EACN;;IAEA,CACA,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,246 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OpenAPI Generator CLI
4
+ * Uses Node's native parseArgs for argument parsing (Node 18.3+)
5
+ */
6
+ import { parseArgs } from "node:util";
7
+ import { generateCommand } from "./commands/generate.js";
8
+ import { listCommand } from "./commands/list.js";
9
+ import { validateCommand } from "./commands/validate.js";
10
+ const VERSION = "0.1.0";
11
+ const USAGE = `
12
+ OpenAPI Generator - Generate code from OpenAPI specifications
13
+
14
+ Usage:
15
+ openapi-generator <command> [options]
16
+
17
+ Commands:
18
+ generate Generate code from an OpenAPI specification
19
+ validate Validate an OpenAPI specification
20
+ list List available generators
21
+
22
+ Options:
23
+ -h, --help Show this help message
24
+ -v, --version Show version number
25
+
26
+ Examples:
27
+ openapi-generator generate -i petstore.json -g typescript-fetch -o ./generated
28
+ openapi-generator validate -i petstore.yaml
29
+ openapi-generator list
30
+
31
+ For more information about a command:
32
+ openapi-generator <command> --help
33
+ `;
34
+ const GENERATE_USAGE = `
35
+ Usage: openapi-generator generate [options]
36
+
37
+ Generate code from an OpenAPI specification
38
+
39
+ Required Options:
40
+ -i, --input <file> Path to OpenAPI spec file (JSON or YAML)
41
+ -g, --generator <name> Generator name (e.g., typescript-fetch)
42
+
43
+ Output Options:
44
+ -o, --output <dir> Output directory (default: ./generated)
45
+ -t, --templates <dir> Custom templates directory
46
+ --library <name> Library/variant to use
47
+
48
+ Package Options:
49
+ -p, --package <name> Package name
50
+ --api-package <name> API package name
51
+ --model-package <name> Model package name
52
+
53
+ Generation Options:
54
+ --skip-models Skip model generation
55
+ --skip-apis Skip API generation
56
+ --skip-supporting Skip supporting files
57
+ --skip-overwrite Don't overwrite existing files
58
+ --minimal-update Only write if content changed
59
+ --dry-run Don't write files, show what would be generated
60
+
61
+ Additional Options:
62
+ --additional-properties <props> Additional properties as key=value,key2=value2
63
+ --type-mappings <mappings> Type mappings as openApiType=targetType,...
64
+ --import-mappings <mappings> Import mappings as type=import,...
65
+
66
+ Other:
67
+ -v, --verbose Enable verbose output
68
+ --debug Enable debug output
69
+ -h, --help Show this help message
70
+ `;
71
+ const VALIDATE_USAGE = `
72
+ Usage: openapi-generator validate [options]
73
+
74
+ Validate an OpenAPI specification
75
+
76
+ Options:
77
+ -i, --input <file> Path to OpenAPI spec file (JSON or YAML)
78
+ --strict Enable strict validation
79
+ -h, --help Show this help message
80
+ `;
81
+ const LIST_USAGE = `
82
+ Usage: openapi-generator list
83
+
84
+ List all available generators
85
+ `;
86
+ async function main() {
87
+ const args = process.argv.slice(2);
88
+ // Handle no args or top-level help
89
+ if (args.length === 0 || args[0] === "-h" || args[0] === "--help") {
90
+ console.log(USAGE);
91
+ process.exit(0);
92
+ }
93
+ // Handle version
94
+ if (args[0] === "-v" || args[0] === "--version") {
95
+ console.log(VERSION);
96
+ process.exit(0);
97
+ }
98
+ const command = args[0];
99
+ const commandArgs = args.slice(1);
100
+ try {
101
+ switch (command) {
102
+ case "generate":
103
+ await handleGenerate(commandArgs);
104
+ break;
105
+ case "validate":
106
+ await handleValidate(commandArgs);
107
+ break;
108
+ case "list":
109
+ handleList(commandArgs);
110
+ break;
111
+ default:
112
+ console.error(`Unknown command: ${command}`);
113
+ console.log(USAGE);
114
+ process.exit(1);
115
+ }
116
+ }
117
+ catch (error) {
118
+ console.error("Error:", error instanceof Error ? error.message : error);
119
+ if (process.env.DEBUG) {
120
+ console.error(error);
121
+ }
122
+ process.exit(1);
123
+ }
124
+ }
125
+ async function handleGenerate(args) {
126
+ // Check for help
127
+ if (args.includes("-h") || args.includes("--help")) {
128
+ console.log(GENERATE_USAGE);
129
+ process.exit(0);
130
+ }
131
+ const { values } = parseArgs({
132
+ args,
133
+ options: {
134
+ input: { type: "string", short: "i" },
135
+ generator: { type: "string", short: "g" },
136
+ output: { type: "string", short: "o", default: "./generated" },
137
+ templates: { type: "string", short: "t" },
138
+ library: { type: "string" },
139
+ package: { type: "string", short: "p" },
140
+ "api-package": { type: "string" },
141
+ "model-package": { type: "string" },
142
+ "skip-models": { type: "boolean", default: false },
143
+ "skip-apis": { type: "boolean", default: false },
144
+ "skip-supporting": { type: "boolean", default: false },
145
+ "skip-overwrite": { type: "boolean", default: false },
146
+ "minimal-update": { type: "boolean", default: true },
147
+ "dry-run": { type: "boolean", default: false },
148
+ "additional-properties": { type: "string" },
149
+ "type-mappings": { type: "string" },
150
+ "import-mappings": { type: "string" },
151
+ verbose: { type: "boolean", short: "v", default: false },
152
+ debug: { type: "boolean", default: false },
153
+ },
154
+ strict: true,
155
+ });
156
+ // Validate required options
157
+ if (!values.input) {
158
+ console.error("Error: --input (-i) is required");
159
+ console.log(GENERATE_USAGE);
160
+ process.exit(1);
161
+ }
162
+ if (!values.generator) {
163
+ console.error("Error: --generator (-g) is required");
164
+ console.log(GENERATE_USAGE);
165
+ process.exit(1);
166
+ }
167
+ // Parse additional properties
168
+ const additionalProperties = parseKeyValuePairs(values["additional-properties"]);
169
+ const typeMappings = parseKeyValuePairs(values["type-mappings"]);
170
+ const importMappings = parseKeyValuePairs(values["import-mappings"]);
171
+ await generateCommand({
172
+ inputSpec: values.input,
173
+ generatorName: values.generator,
174
+ outputDir: values.output,
175
+ templateDir: values.templates,
176
+ library: values.library,
177
+ packageName: values.package,
178
+ apiPackage: values["api-package"],
179
+ modelPackage: values["model-package"],
180
+ generateModels: !values["skip-models"],
181
+ generateApis: !values["skip-apis"],
182
+ generateSupportingFiles: !values["skip-supporting"],
183
+ skipOverwrite: values["skip-overwrite"],
184
+ minimalUpdate: values["minimal-update"],
185
+ dryRun: values["dry-run"],
186
+ additionalProperties,
187
+ typeMappings,
188
+ importMappings,
189
+ verbose: values.verbose,
190
+ debug: values.debug,
191
+ });
192
+ }
193
+ async function handleValidate(args) {
194
+ // Check for help
195
+ if (args.includes("-h") || args.includes("--help")) {
196
+ console.log(VALIDATE_USAGE);
197
+ process.exit(0);
198
+ }
199
+ const { values } = parseArgs({
200
+ args,
201
+ options: {
202
+ input: { type: "string", short: "i" },
203
+ strict: { type: "boolean", default: false },
204
+ },
205
+ strict: true,
206
+ });
207
+ if (!values.input) {
208
+ console.error("Error: --input (-i) is required");
209
+ console.log(VALIDATE_USAGE);
210
+ process.exit(1);
211
+ }
212
+ await validateCommand({
213
+ inputSpec: values.input,
214
+ strict: values.strict,
215
+ });
216
+ }
217
+ function handleList(args) {
218
+ // Check for help
219
+ if (args.includes("-h") || args.includes("--help")) {
220
+ console.log(LIST_USAGE);
221
+ process.exit(0);
222
+ }
223
+ listCommand();
224
+ }
225
+ /**
226
+ * Parse comma-separated key=value pairs
227
+ */
228
+ function parseKeyValuePairs(input) {
229
+ if (!input)
230
+ return {};
231
+ const result = {};
232
+ const pairs = input.split(",");
233
+ for (const pair of pairs) {
234
+ const [key, ...valueParts] = pair.split("=");
235
+ if (key && valueParts.length > 0) {
236
+ result[key.trim()] = valueParts.join("=").trim();
237
+ }
238
+ }
239
+ return result;
240
+ }
241
+ // Run the CLI
242
+ main().catch((error) => {
243
+ console.error("Fatal error:", error);
244
+ process.exit(1);
245
+ });
246
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,E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