typia 13.0.0-dev.20260501 → 13.0.0-dev.20260506

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 (371) hide show
  1. package/lib/executable/generate/ttsc.js.map +1 -1
  2. package/lib/executable/setup/PluginConfigurator.js.map +1 -1
  3. package/lib/internal/_randomInteger.js.map +1 -1
  4. package/lib/internal/_validateReport.js.map +1 -1
  5. package/lib/transform.js.map +1 -1
  6. package/native/adapter/adapter.go +128 -128
  7. package/native/adapter/cleanup.go +155 -155
  8. package/native/adapter/imports.go +80 -80
  9. package/native/adapter/visit.go +142 -142
  10. package/native/cmd/ttsc-typia/build.go +223 -223
  11. package/native/cmd/ttsc-typia/main.go +57 -57
  12. package/native/cmd/ttsc-typia/transform.go +393 -385
  13. package/native/cmd/ttsc-typia/transform_test.go +40 -0
  14. package/native/core/context/IProgrammerProps.go +7 -7
  15. package/native/core/context/ITransformOptions.go +5 -5
  16. package/native/core/context/ITypiaContext.go +13 -13
  17. package/native/core/context/TransformerError.go +81 -81
  18. package/native/core/factories/CommentFactory.go +9 -9
  19. package/native/core/factories/ExpressionFactory.go +254 -254
  20. package/native/core/factories/FormatCheatSheet.go +23 -23
  21. package/native/core/factories/IdentifierFactory.go +130 -130
  22. package/native/core/factories/JsonMetadataFactory.go +129 -129
  23. package/native/core/factories/LiteralFactory.go +192 -192
  24. package/native/core/factories/MetadataCommentTagFactory.go +379 -379
  25. package/native/core/factories/MetadataFactory.go +462 -462
  26. package/native/core/factories/MetadataTypeTagFactory.go +498 -498
  27. package/native/core/factories/MetadataTypeTagSchemaFactory.go +102 -102
  28. package/native/core/factories/NumericRangeFactory.go +84 -84
  29. package/native/core/factories/ProtobufFactory.go +933 -933
  30. package/native/core/factories/StatementFactory.go +72 -72
  31. package/native/core/factories/TemplateFactory.go +57 -57
  32. package/native/core/factories/TypeFactory.go +125 -125
  33. package/native/core/factories/ValueFactory.go +12 -12
  34. package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +35 -35
  35. package/native/core/factories/internal/metadata/MetadataHelper.go +176 -176
  36. package/native/core/factories/internal/metadata/emend_metadata_atomics.go +69 -69
  37. package/native/core/factories/internal/metadata/emplace_metadata_alias.go +27 -27
  38. package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +33 -33
  39. package/native/core/factories/internal/metadata/emplace_metadata_object.go +209 -209
  40. package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +50 -50
  41. package/native/core/factories/internal/metadata/explore_metadata.go +29 -29
  42. package/native/core/factories/internal/metadata/iterate_metadata.go +46 -46
  43. package/native/core/factories/internal/metadata/iterate_metadata_alias.go +25 -25
  44. package/native/core/factories/internal/metadata/iterate_metadata_array.go +65 -65
  45. package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +49 -49
  46. package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +22 -22
  47. package/native/core/factories/internal/metadata/iterate_metadata_collection.go +228 -228
  48. package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +12 -12
  49. package/native/core/factories/internal/metadata/iterate_metadata_constant.go +71 -71
  50. package/native/core/factories/internal/metadata/iterate_metadata_escape.go +48 -48
  51. package/native/core/factories/internal/metadata/iterate_metadata_function.go +82 -82
  52. package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +319 -319
  53. package/native/core/factories/internal/metadata/iterate_metadata_map.go +51 -51
  54. package/native/core/factories/internal/metadata/iterate_metadata_native.go +85 -85
  55. package/native/core/factories/internal/metadata/iterate_metadata_object.go +27 -27
  56. package/native/core/factories/internal/metadata/iterate_metadata_set.go +37 -37
  57. package/native/core/factories/internal/metadata/iterate_metadata_sort.go +137 -137
  58. package/native/core/factories/internal/metadata/iterate_metadata_template.go +33 -33
  59. package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +16 -16
  60. package/native/core/factories/internal/metadata/iterate_metadata_union.go +18 -18
  61. package/native/core/programmers/AssertProgrammer.go +389 -389
  62. package/native/core/programmers/ImportProgrammer.go +196 -196
  63. package/native/core/programmers/IsProgrammer.go +293 -293
  64. package/native/core/programmers/RandomProgrammer.go +1094 -1094
  65. package/native/core/programmers/ValidateProgrammer.go +369 -369
  66. package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +133 -133
  67. package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +104 -104
  68. package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +100 -100
  69. package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +79 -79
  70. package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +159 -159
  71. package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +99 -99
  72. package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +138 -138
  73. package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +222 -222
  74. package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +116 -116
  75. package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +36 -36
  76. package/native/core/programmers/helpers/AtomicPredicator.go +35 -35
  77. package/native/core/programmers/helpers/CloneJoiner.go +217 -217
  78. package/native/core/programmers/helpers/FunctionProgrammer.go +79 -79
  79. package/native/core/programmers/helpers/HttpMetadataUtil.go +17 -17
  80. package/native/core/programmers/helpers/ICheckEntry.go +5 -5
  81. package/native/core/programmers/helpers/IExpressionEntry.go +6 -6
  82. package/native/core/programmers/helpers/NotationJoiner.go +159 -159
  83. package/native/core/programmers/helpers/OptionPredicator.go +4 -4
  84. package/native/core/programmers/helpers/ProtobufUtil.go +231 -231
  85. package/native/core/programmers/helpers/ProtobufWire.go +6 -6
  86. package/native/core/programmers/helpers/PruneJoiner.go +227 -227
  87. package/native/core/programmers/helpers/RandomJoiner.go +155 -155
  88. package/native/core/programmers/helpers/StringifyJoinder.go +331 -331
  89. package/native/core/programmers/helpers/StringifyPredicator.go +10 -10
  90. package/native/core/programmers/helpers/UnionExplorer.go +835 -835
  91. package/native/core/programmers/helpers/UnionPredicator.go +78 -78
  92. package/native/core/programmers/helpers/disable_function_programmer_declare.go +6 -6
  93. package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +93 -93
  94. package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +42 -42
  95. package/native/core/programmers/http/HttpAssertQueryProgrammer.go +51 -51
  96. package/native/core/programmers/http/HttpFormDataProgrammer.go +351 -351
  97. package/native/core/programmers/http/HttpHeadersProgrammer.go +370 -370
  98. package/native/core/programmers/http/HttpIsFormDataProgrammer.go +109 -109
  99. package/native/core/programmers/http/HttpIsHeadersProgrammer.go +36 -36
  100. package/native/core/programmers/http/HttpIsQueryProgrammer.go +45 -45
  101. package/native/core/programmers/http/HttpParameterProgrammer.go +158 -158
  102. package/native/core/programmers/http/HttpQueryProgrammer.go +422 -422
  103. package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +87 -87
  104. package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +39 -39
  105. package/native/core/programmers/http/HttpValidateQueryProgrammer.go +48 -48
  106. package/native/core/programmers/internal/CheckerProgrammer.go +1490 -1490
  107. package/native/core/programmers/internal/FeatureProgrammer.go +589 -589
  108. package/native/core/programmers/iterate/check_array_length.go +46 -46
  109. package/native/core/programmers/iterate/check_bigint.go +52 -52
  110. package/native/core/programmers/iterate/check_dynamic_key.go +220 -220
  111. package/native/core/programmers/iterate/check_dynamic_properties.go +245 -245
  112. package/native/core/programmers/iterate/check_everything.go +21 -21
  113. package/native/core/programmers/iterate/check_native.go +25 -25
  114. package/native/core/programmers/iterate/check_number.go +135 -135
  115. package/native/core/programmers/iterate/check_object.go +66 -66
  116. package/native/core/programmers/iterate/check_string.go +52 -52
  117. package/native/core/programmers/iterate/check_template.go +57 -57
  118. package/native/core/programmers/iterate/check_union_array_like.go +372 -372
  119. package/native/core/programmers/iterate/decode_union_object.go +118 -118
  120. package/native/core/programmers/iterate/feature_object_entries.go +134 -134
  121. package/native/core/programmers/iterate/json_schema_alias.go +52 -52
  122. package/native/core/programmers/iterate/json_schema_array.go +52 -52
  123. package/native/core/programmers/iterate/json_schema_bigint.go +8 -8
  124. package/native/core/programmers/iterate/json_schema_boolean.go +8 -8
  125. package/native/core/programmers/iterate/json_schema_constant.go +38 -38
  126. package/native/core/programmers/iterate/json_schema_description.go +12 -12
  127. package/native/core/programmers/iterate/json_schema_discriminator.go +47 -47
  128. package/native/core/programmers/iterate/json_schema_escaped.go +58 -58
  129. package/native/core/programmers/iterate/json_schema_jsDocTags.go +34 -34
  130. package/native/core/programmers/iterate/json_schema_native.go +43 -43
  131. package/native/core/programmers/iterate/json_schema_number.go +8 -8
  132. package/native/core/programmers/iterate/json_schema_object.go +149 -149
  133. package/native/core/programmers/iterate/json_schema_plugin.go +35 -35
  134. package/native/core/programmers/iterate/json_schema_station.go +211 -211
  135. package/native/core/programmers/iterate/json_schema_string.go +8 -8
  136. package/native/core/programmers/iterate/json_schema_template.go +53 -53
  137. package/native/core/programmers/iterate/json_schema_title.go +16 -16
  138. package/native/core/programmers/iterate/json_schema_tuple.go +34 -34
  139. package/native/core/programmers/iterate/metadata_to_pattern.go +53 -53
  140. package/native/core/programmers/iterate/postfix_of_tuple.go +5 -5
  141. package/native/core/programmers/iterate/prune_object_properties.go +85 -85
  142. package/native/core/programmers/iterate/stringify_dynamic_properties.go +193 -193
  143. package/native/core/programmers/iterate/stringify_native.go +1 -1
  144. package/native/core/programmers/iterate/stringify_regular_properties.go +84 -84
  145. package/native/core/programmers/iterate/template_to_pattern.go +20 -20
  146. package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +13 -13
  147. package/native/core/programmers/json/JsonApplicationProgrammer.go +323 -323
  148. package/native/core/programmers/json/JsonAssertParseProgrammer.go +100 -100
  149. package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +88 -88
  150. package/native/core/programmers/json/JsonIsParseProgrammer.go +130 -130
  151. package/native/core/programmers/json/JsonIsStringifyProgrammer.go +92 -92
  152. package/native/core/programmers/json/JsonSchemaProgrammer.go +65 -65
  153. package/native/core/programmers/json/JsonSchemasProgrammer.go +116 -116
  154. package/native/core/programmers/json/JsonStringifyProgrammer.go +1245 -1245
  155. package/native/core/programmers/json/JsonValidateParseProgrammer.go +89 -89
  156. package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +106 -106
  157. package/native/core/programmers/llm/LlmApplicationProgrammer.go +445 -445
  158. package/native/core/programmers/llm/LlmCoerceProgrammer.go +79 -79
  159. package/native/core/programmers/llm/LlmControllerProgrammer.go +35 -35
  160. package/native/core/programmers/llm/LlmMetadataFactory.go +74 -74
  161. package/native/core/programmers/llm/LlmParametersProgrammer.go +104 -104
  162. package/native/core/programmers/llm/LlmParseProgrammer.go +88 -88
  163. package/native/core/programmers/llm/LlmSchemaProgrammer.go +702 -702
  164. package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +123 -123
  165. package/native/core/programmers/misc/MiscAssertCloneProgrammer.go +82 -82
  166. package/native/core/programmers/misc/MiscAssertPruneProgrammer.go +97 -97
  167. package/native/core/programmers/misc/MiscCloneProgrammer.go +1056 -1056
  168. package/native/core/programmers/misc/MiscIsCloneProgrammer.go +94 -94
  169. package/native/core/programmers/misc/MiscIsPruneProgrammer.go +86 -86
  170. package/native/core/programmers/misc/MiscLiteralsProgrammer.go +99 -99
  171. package/native/core/programmers/misc/MiscPruneProgrammer.go +700 -700
  172. package/native/core/programmers/misc/MiscValidateCloneProgrammer.go +103 -103
  173. package/native/core/programmers/misc/MiscValidatePruneProgrammer.go +94 -94
  174. package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +85 -85
  175. package/native/core/programmers/notations/NotationGeneralProgrammer.go +1188 -1188
  176. package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +90 -90
  177. package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +109 -109
  178. package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +99 -99
  179. package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +114 -114
  180. package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +697 -697
  181. package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1039 -1039
  182. package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +99 -99
  183. package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +93 -93
  184. package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +228 -228
  185. package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +88 -88
  186. package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +120 -120
  187. package/native/core/schemas/metadata/IMetadataDictionary.go +4 -4
  188. package/native/core/schemas/metadata/MetadataAlias.go +15 -15
  189. package/native/core/schemas/metadata/MetadataAliasType.go +36 -36
  190. package/native/core/schemas/metadata/MetadataApplication.go +25 -25
  191. package/native/core/schemas/metadata/MetadataArray.go +15 -15
  192. package/native/core/schemas/metadata/MetadataArrayType.go +31 -31
  193. package/native/core/schemas/metadata/MetadataAtomic.go +45 -45
  194. package/native/core/schemas/metadata/MetadataCollection.go +380 -380
  195. package/native/core/schemas/metadata/MetadataComponents.go +95 -95
  196. package/native/core/schemas/metadata/MetadataConstant.go +31 -31
  197. package/native/core/schemas/metadata/MetadataConstantValue.go +63 -63
  198. package/native/core/schemas/metadata/MetadataEscaped.go +17 -17
  199. package/native/core/schemas/metadata/MetadataFunction.go +30 -30
  200. package/native/core/schemas/metadata/MetadataMap.go +21 -21
  201. package/native/core/schemas/metadata/MetadataNative.go +48 -48
  202. package/native/core/schemas/metadata/MetadataObject.go +15 -15
  203. package/native/core/schemas/metadata/MetadataObjectType.go +116 -116
  204. package/native/core/schemas/metadata/MetadataParameter.go +28 -28
  205. package/native/core/schemas/metadata/MetadataProperty.go +32 -32
  206. package/native/core/schemas/metadata/MetadataSchema.go +766 -766
  207. package/native/core/schemas/metadata/MetadataSet.go +17 -17
  208. package/native/core/schemas/metadata/MetadataTemplate.go +43 -43
  209. package/native/core/schemas/metadata/MetadataTuple.go +10 -10
  210. package/native/core/schemas/metadata/MetadataTupleType.go +38 -38
  211. package/native/core/schemas/protobuf/IProtobufProperty.go +2 -2
  212. package/native/core/schemas/protobuf/IProtobufPropertyType.go +18 -18
  213. package/native/core/schemas/protobuf/IProtobufSchema.go +17 -17
  214. package/native/core/typings/Writable.go +1 -1
  215. package/native/core/utils/PatternUtil.go +38 -38
  216. package/native/core/utils/ProtobufNameEncoder.go +28 -28
  217. package/native/shim/printer/go.mod +1 -1
  218. package/native/shim/printer/shim.go +213 -213
  219. package/native/third_party/ttsc/driver/host.go +9 -9
  220. package/native/third_party/ttsc/driver/program.go +344 -281
  221. package/native/third_party/ttsc/driver/rewrite.go +247 -221
  222. package/native/third_party/ttsc/go.mod +5 -3
  223. package/native/third_party/ttsc/go.sum +2 -2
  224. package/native/third_party/ttsc/shim/ast/go.mod +1 -1
  225. package/native/third_party/ttsc/shim/ast/lint.go +174 -171
  226. package/native/third_party/ttsc/shim/ast/shim.go +86 -85
  227. package/native/third_party/ttsc/shim/bundled/go.mod +1 -1
  228. package/native/third_party/ttsc/shim/bundled/shim.go +5 -1
  229. package/native/third_party/ttsc/shim/checker/go.mod +1 -1
  230. package/native/third_party/ttsc/shim/checker/shim.go +79 -79
  231. package/native/third_party/ttsc/shim/compiler/go.mod +1 -1
  232. package/native/third_party/ttsc/shim/compiler/shim.go +16 -1
  233. package/native/third_party/ttsc/shim/core/go.mod +1 -1
  234. package/native/third_party/ttsc/shim/core/shim.go +13 -10
  235. package/native/third_party/ttsc/shim/diagnosticwriter/go.mod +1 -1
  236. package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +79 -79
  237. package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +19 -19
  238. package/native/third_party/ttsc/shim/parser/go.mod +1 -1
  239. package/native/third_party/ttsc/shim/parser/shim.go +7 -1
  240. package/native/third_party/ttsc/shim/scanner/go.mod +1 -1
  241. package/native/third_party/ttsc/shim/scanner/shim.go +39 -1
  242. package/native/third_party/ttsc/shim/tsoptions/go.mod +1 -1
  243. package/native/third_party/ttsc/shim/tsoptions/shim.go +51 -1
  244. package/native/third_party/ttsc/shim/tspath/go.mod +1 -1
  245. package/native/third_party/ttsc/shim/tspath/shim.go +72 -1
  246. package/native/third_party/ttsc/shim/vfs/cachedvfs/go.mod +1 -1
  247. package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +1 -1
  248. package/native/third_party/ttsc/shim/vfs/go.mod +1 -1
  249. package/native/third_party/ttsc/shim/vfs/osvfs/go.mod +1 -1
  250. package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +1 -1
  251. package/native/third_party/ttsc/shim/vfs/shim.go +4 -1
  252. package/native/transform/CallExpressionTransformer.go +556 -556
  253. package/native/transform/FileTransformer.go +123 -123
  254. package/native/transform/ImportTransformer.go +224 -224
  255. package/native/transform/NodeTransformer.go +11 -11
  256. package/native/transform/TypiaGenerator.go +136 -136
  257. package/native/transform/features/AssertTransformer.go +28 -28
  258. package/native/transform/features/CreateAssertTransformer.go +28 -28
  259. package/native/transform/features/CreateIsTransformer.go +24 -24
  260. package/native/transform/features/CreateRandomTransformer.go +35 -35
  261. package/native/transform/features/CreateValidateTransformer.go +24 -24
  262. package/native/transform/features/IsTransformer.go +24 -24
  263. package/native/transform/features/RandomTransformer.go +37 -37
  264. package/native/transform/features/ValidateTransformer.go +24 -24
  265. package/native/transform/features/functional/FunctionalGenericTransformer.go +48 -48
  266. package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +11 -11
  267. package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +11 -11
  268. package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +17 -17
  269. package/native/transform/features/http/CreateHttpFormDataTransformer.go +11 -11
  270. package/native/transform/features/http/CreateHttpHeadersTransformer.go +11 -11
  271. package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +11 -11
  272. package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +11 -11
  273. package/native/transform/features/http/CreateHttpIsQueryTransformer.go +17 -17
  274. package/native/transform/features/http/CreateHttpParameterTransformer.go +11 -11
  275. package/native/transform/features/http/CreateHttpQueryTransformer.go +17 -17
  276. package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +11 -11
  277. package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +11 -11
  278. package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +17 -17
  279. package/native/transform/features/http/HttpAssertFormDataTransformer.go +11 -11
  280. package/native/transform/features/http/HttpAssertHeadersTransformer.go +11 -11
  281. package/native/transform/features/http/HttpAssertQueryTransformer.go +17 -17
  282. package/native/transform/features/http/HttpFormDataTransformer.go +11 -11
  283. package/native/transform/features/http/HttpHeadersTransformer.go +11 -11
  284. package/native/transform/features/http/HttpIsFormDataTransformer.go +11 -11
  285. package/native/transform/features/http/HttpIsHeadersTransformer.go +11 -11
  286. package/native/transform/features/http/HttpIsQueryTransformer.go +17 -17
  287. package/native/transform/features/http/HttpParameterTransformer.go +11 -11
  288. package/native/transform/features/http/HttpQueryTransformer.go +17 -17
  289. package/native/transform/features/http/HttpValidateFormDataTransformer.go +11 -11
  290. package/native/transform/features/http/HttpValidateHeadersTransformer.go +11 -11
  291. package/native/transform/features/http/HttpValidateQueryTransformer.go +17 -17
  292. package/native/transform/features/json/JsonApplicationTransformer.go +61 -61
  293. package/native/transform/features/json/JsonAssertParseTransformer.go +11 -11
  294. package/native/transform/features/json/JsonAssertStringifyTransformer.go +11 -11
  295. package/native/transform/features/json/JsonCreateAssertParseTransformer.go +11 -11
  296. package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +11 -11
  297. package/native/transform/features/json/JsonCreateIsParseTransformer.go +11 -11
  298. package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +11 -11
  299. package/native/transform/features/json/JsonCreateStringifyTransformer.go +11 -11
  300. package/native/transform/features/json/JsonCreateValidateParseTransformer.go +11 -11
  301. package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +11 -11
  302. package/native/transform/features/json/JsonIsParseTransformer.go +11 -11
  303. package/native/transform/features/json/JsonIsStringifyTransformer.go +11 -11
  304. package/native/transform/features/json/JsonSchemaTransformer.go +148 -148
  305. package/native/transform/features/json/JsonSchemasTransformer.go +94 -94
  306. package/native/transform/features/json/JsonStringifyTransformer.go +11 -11
  307. package/native/transform/features/json/JsonValidateParseTransformer.go +11 -11
  308. package/native/transform/features/json/JsonValidateStringifyTransformer.go +11 -11
  309. package/native/transform/features/llm/LlmApplicationTransformer.go +43 -43
  310. package/native/transform/features/llm/LlmCoerceTransformer.go +50 -50
  311. package/native/transform/features/llm/LlmControllerTransformer.go +48 -48
  312. package/native/transform/features/llm/LlmCreateCoerceTransformer.go +43 -43
  313. package/native/transform/features/llm/LlmCreateParseTransformer.go +43 -43
  314. package/native/transform/features/llm/LlmParametersTransformer.go +38 -38
  315. package/native/transform/features/llm/LlmParseTransformer.go +50 -50
  316. package/native/transform/features/llm/LlmSchemaTransformer.go +129 -129
  317. package/native/transform/features/llm/LlmStructuredOutputTransformer.go +44 -44
  318. package/native/transform/features/misc/MiscAssertCloneTransformer.go +11 -11
  319. package/native/transform/features/misc/MiscAssertPruneTransformer.go +11 -11
  320. package/native/transform/features/misc/MiscCloneTransformer.go +11 -11
  321. package/native/transform/features/misc/MiscCreateAssertCloneTransformer.go +11 -11
  322. package/native/transform/features/misc/MiscCreateAssertPruneTransformer.go +11 -11
  323. package/native/transform/features/misc/MiscCreateCloneTransformer.go +11 -11
  324. package/native/transform/features/misc/MiscCreateIsCloneTransformer.go +11 -11
  325. package/native/transform/features/misc/MiscCreateIsPruneTransformer.go +11 -11
  326. package/native/transform/features/misc/MiscCreatePruneTransformer.go +11 -11
  327. package/native/transform/features/misc/MiscCreateValidateCloneTransformer.go +11 -11
  328. package/native/transform/features/misc/MiscCreateValidatePruneTransformer.go +11 -11
  329. package/native/transform/features/misc/MiscIsCloneTransformer.go +11 -11
  330. package/native/transform/features/misc/MiscIsPruneTransformer.go +11 -11
  331. package/native/transform/features/misc/MiscLiteralsTransformer.go +21 -21
  332. package/native/transform/features/misc/MiscPruneTransformer.go +11 -11
  333. package/native/transform/features/misc/MiscValidateCloneTransformer.go +11 -11
  334. package/native/transform/features/misc/MiscValidatePruneTransformer.go +11 -11
  335. package/native/transform/features/notations/NotationAssertGeneralTransformer.go +16 -16
  336. package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +16 -16
  337. package/native/transform/features/notations/NotationCreateGeneralTransformer.go +16 -16
  338. package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +16 -16
  339. package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +16 -16
  340. package/native/transform/features/notations/NotationGeneralTransformer.go +21 -21
  341. package/native/transform/features/notations/NotationIsGeneralTransformer.go +16 -16
  342. package/native/transform/features/notations/NotationValidateGeneralTransformer.go +16 -16
  343. package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +11 -11
  344. package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +11 -11
  345. package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +11 -11
  346. package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +11 -11
  347. package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +11 -11
  348. package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +11 -11
  349. package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +11 -11
  350. package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +11 -11
  351. package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +11 -11
  352. package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +11 -11
  353. package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +11 -11
  354. package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +11 -11
  355. package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +11 -11
  356. package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +11 -11
  357. package/native/transform/features/protobuf/ProtobufMessageTransformer.go +20 -20
  358. package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +11 -11
  359. package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +11 -11
  360. package/native/transform/features/reflect/ReflectMetadataTransformer.go +59 -59
  361. package/native/transform/features/reflect/ReflectNameTransformer.go +78 -78
  362. package/native/transform/features/reflect/ReflectSchemaTransformer.go +121 -121
  363. package/native/transform/features/reflect/ReflectSchemasTransformer.go +55 -55
  364. package/native/transform/internal/GenericTransformer.go +173 -173
  365. package/native/transform/transform.go +32 -32
  366. package/package.json +5 -5
  367. package/src/executable/generate/ttsc.ts +2 -3
  368. package/src/executable/setup/PluginConfigurator.ts +2 -3
  369. package/src/internal/_randomInteger.ts +5 -5
  370. package/src/internal/_validateReport.ts +1 -2
  371. package/src/transform.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  package factories
2
2
 
3
3
  import (
4
- "math"
5
- "strconv"
6
- "strings"
4
+ "math"
5
+ "strconv"
6
+ "strings"
7
7
 
8
- schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
8
+ schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
9
9
  )
10
10
 
11
11
  type metadataCommentTagFactoryNamespace struct{}
@@ -15,419 +15,419 @@ var MetadataCommentTagFactory = metadataCommentTagFactoryNamespace{}
15
15
  type metadataCommentTagFactory_TagRecord map[string][]schemametadata.IMetadataTypeTag
16
16
 
17
17
  type metadataCommentTagFactory_parser func(props struct {
18
- Report func(msg string) any
19
- Value string
18
+ Report func(msg string) any
19
+ Value string
20
20
  }) metadataCommentTagFactory_TagRecord
21
21
 
22
22
  func (metadataCommentTagFactoryNamespace) Analyze(props struct {
23
- Errors *[]MetadataFactory_IError
24
- Metadata *schemametadata.MetadataSchema
25
- Tags []schemametadata.IJsDocTagInfo
26
- Explore MetadataFactory_IExplore
23
+ Errors *[]MetadataFactory_IError
24
+ Metadata *schemametadata.MetadataSchema
25
+ Tags []schemametadata.IJsDocTagInfo
26
+ Explore MetadataFactory_IExplore
27
27
  }) {
28
- messages := []string{}
29
- report := func(msg string) any {
30
- messages = append(messages, msg)
31
- return nil
32
- }
33
- validateReport := func(next struct {
34
- Property *string
35
- Message string
36
- }) bool {
37
- property := "[\"typia.tag\"]"
38
- if next.Property != nil {
39
- property = "[\"typia.tag." + *next.Property + "\"]"
40
- }
41
- messages = append(messages, "the property "+property+" "+next.Message+".")
42
- return false
43
- }
28
+ messages := []string{}
29
+ report := func(msg string) any {
30
+ messages = append(messages, msg)
31
+ return nil
32
+ }
33
+ validateReport := func(next struct {
34
+ Property *string
35
+ Message string
36
+ }) bool {
37
+ property := "[\"typia.tag\"]"
38
+ if next.Property != nil {
39
+ property = "[\"typia.tag." + *next.Property + "\"]"
40
+ }
41
+ messages = append(messages, "the property "+property+" "+next.Message+".")
42
+ return false
43
+ }
44
44
 
45
- for _, tag := range props.Tags {
46
- tagger := metadataCommentTagFactory_parse(struct {
47
- Report func(msg string) any
48
- Tag schemametadata.IJsDocTagInfo
49
- }{Report: report, Tag: tag})
50
- if tagger == nil {
51
- continue
52
- }
53
- for key, value := range tagger {
54
- filtered := []schemametadata.IMetadataTypeTag{}
55
- for _, elem := range value {
56
- filtered = append(filtered, elem)
57
- }
58
- if key == "array" {
59
- if len(props.Metadata.Arrays) == 0 {
60
- report("requires array type")
61
- continue
62
- }
63
- for _, array := range props.Metadata.Arrays {
64
- rows := [][]schemametadata.IMetadataTypeTag{}
65
- for _, row := range array.Tags {
66
- candidate := append(append([]schemametadata.IMetadataTypeTag{}, row...), filtered...)
67
- if MetadataTypeTagFactory.Validate(struct {
68
- Report func(struct {
69
- Property *string
70
- Message string
71
- }) bool
72
- Type string
73
- Tags []schemametadata.IMetadataTypeTag
74
- }{Report: validateReport, Type: "array", Tags: candidate}) {
75
- rows = append(rows, row)
76
- }
77
- }
78
- array.Tags = rows
79
- if len(array.Tags) == 0 {
80
- array.Tags = append(array.Tags, filtered)
81
- } else {
82
- for i := range array.Tags {
83
- array.Tags[i] = append(array.Tags[i], filtered...)
84
- }
85
- }
86
- }
87
- continue
88
- }
45
+ for _, tag := range props.Tags {
46
+ tagger := metadataCommentTagFactory_parse(struct {
47
+ Report func(msg string) any
48
+ Tag schemametadata.IJsDocTagInfo
49
+ }{Report: report, Tag: tag})
50
+ if tagger == nil {
51
+ continue
52
+ }
53
+ for key, value := range tagger {
54
+ filtered := []schemametadata.IMetadataTypeTag{}
55
+ for _, elem := range value {
56
+ filtered = append(filtered, elem)
57
+ }
58
+ if key == "array" {
59
+ if len(props.Metadata.Arrays) == 0 {
60
+ report("requires array type")
61
+ continue
62
+ }
63
+ for _, array := range props.Metadata.Arrays {
64
+ rows := [][]schemametadata.IMetadataTypeTag{}
65
+ for _, row := range array.Tags {
66
+ candidate := append(append([]schemametadata.IMetadataTypeTag{}, row...), filtered...)
67
+ if MetadataTypeTagFactory.Validate(struct {
68
+ Report func(struct {
69
+ Property *string
70
+ Message string
71
+ }) bool
72
+ Type string
73
+ Tags []schemametadata.IMetadataTypeTag
74
+ }{Report: validateReport, Type: "array", Tags: candidate}) {
75
+ rows = append(rows, row)
76
+ }
77
+ }
78
+ array.Tags = rows
79
+ if len(array.Tags) == 0 {
80
+ array.Tags = append(array.Tags, filtered)
81
+ } else {
82
+ for i := range array.Tags {
83
+ array.Tags[i] = append(array.Tags[i], filtered...)
84
+ }
85
+ }
86
+ }
87
+ continue
88
+ }
89
89
 
90
- var atomic *schemametadata.MetadataAtomic
91
- for _, candidate := range props.Metadata.Atomics {
92
- if candidate.Type == key {
93
- atomic = candidate
94
- break
95
- }
96
- }
97
- if atomic == nil {
98
- if key == "bigint" || key == "number" {
99
- opposite := "bigint"
100
- if key == "bigint" {
101
- opposite = "number"
102
- }
103
- if _, ok := tagger[opposite]; ok {
104
- found := false
105
- for _, a := range props.Metadata.Atomics {
106
- if a.Type == opposite {
107
- found = true
108
- break
109
- }
110
- }
111
- if found {
112
- continue
113
- }
114
- }
115
- } else if key == "string" && len(value) != 0 && value[0].Kind == "format" && value[0].Value == "date-time" {
116
- continue
117
- }
118
- report("requires " + key + " type")
119
- continue
120
- }
121
- rows := [][]schemametadata.IMetadataTypeTag{}
122
- for _, row := range atomic.Tags {
123
- candidate := append(append([]schemametadata.IMetadataTypeTag{}, row...), filtered...)
124
- if MetadataTypeTagFactory.Validate(struct {
125
- Report func(struct {
126
- Property *string
127
- Message string
128
- }) bool
129
- Type string
130
- Tags []schemametadata.IMetadataTypeTag
131
- }{Report: validateReport, Type: key, Tags: candidate}) {
132
- rows = append(rows, row)
133
- }
134
- }
135
- atomic.Tags = rows
136
- if len(atomic.Tags) == 0 {
137
- atomic.Tags = append(atomic.Tags, filtered)
138
- } else {
139
- for i := range atomic.Tags {
140
- atomic.Tags[i] = append(atomic.Tags[i], filtered...)
141
- }
142
- }
143
- }
144
- }
90
+ var atomic *schemametadata.MetadataAtomic
91
+ for _, candidate := range props.Metadata.Atomics {
92
+ if candidate.Type == key {
93
+ atomic = candidate
94
+ break
95
+ }
96
+ }
97
+ if atomic == nil {
98
+ if key == "bigint" || key == "number" {
99
+ opposite := "bigint"
100
+ if key == "bigint" {
101
+ opposite = "number"
102
+ }
103
+ if _, ok := tagger[opposite]; ok {
104
+ found := false
105
+ for _, a := range props.Metadata.Atomics {
106
+ if a.Type == opposite {
107
+ found = true
108
+ break
109
+ }
110
+ }
111
+ if found {
112
+ continue
113
+ }
114
+ }
115
+ } else if key == "string" && len(value) != 0 && value[0].Kind == "format" && value[0].Value == "date-time" {
116
+ continue
117
+ }
118
+ report("requires " + key + " type")
119
+ continue
120
+ }
121
+ rows := [][]schemametadata.IMetadataTypeTag{}
122
+ for _, row := range atomic.Tags {
123
+ candidate := append(append([]schemametadata.IMetadataTypeTag{}, row...), filtered...)
124
+ if MetadataTypeTagFactory.Validate(struct {
125
+ Report func(struct {
126
+ Property *string
127
+ Message string
128
+ }) bool
129
+ Type string
130
+ Tags []schemametadata.IMetadataTypeTag
131
+ }{Report: validateReport, Type: key, Tags: candidate}) {
132
+ rows = append(rows, row)
133
+ }
134
+ }
135
+ atomic.Tags = rows
136
+ if len(atomic.Tags) == 0 {
137
+ atomic.Tags = append(atomic.Tags, filtered)
138
+ } else {
139
+ for i := range atomic.Tags {
140
+ atomic.Tags[i] = append(atomic.Tags[i], filtered...)
141
+ }
142
+ }
143
+ }
144
+ }
145
145
 
146
- if len(messages) != 0 && props.Errors != nil {
147
- *props.Errors = append(*props.Errors, MetadataFactory_IError{
148
- Name: "comment tag(s)",
149
- Explore: props.Explore,
150
- Messages: messages,
151
- })
152
- }
146
+ if len(messages) != 0 && props.Errors != nil {
147
+ *props.Errors = append(*props.Errors, MetadataFactory_IError{
148
+ Name: "comment tag(s)",
149
+ Explore: props.Explore,
150
+ Messages: messages,
151
+ })
152
+ }
153
153
  }
154
154
 
155
155
  func metadataCommentTagFactory_parse(props struct {
156
- Report func(msg string) any
157
- Tag schemametadata.IJsDocTagInfo
156
+ Report func(msg string) any
157
+ Tag schemametadata.IJsDocTagInfo
158
158
  }) metadataCommentTagFactory_TagRecord {
159
- next := metadataCommentTagFactory_PARSER[props.Tag.Name]
160
- if next == nil {
161
- return metadataCommentTagFactory_TagRecord{}
162
- }
163
- value := ""
164
- if len(props.Tag.Text) != 0 {
165
- value = props.Tag.Text[0].Text
166
- }
167
- if value == "" && props.Tag.Name != "uniqueItems" {
168
- props.Report("no comment tag value")
169
- return nil
170
- }
171
- return next(struct {
172
- Report func(msg string) any
173
- Value string
174
- }{Report: props.Report, Value: value})
159
+ next := metadataCommentTagFactory_PARSER[props.Tag.Name]
160
+ if next == nil {
161
+ return metadataCommentTagFactory_TagRecord{}
162
+ }
163
+ value := ""
164
+ if len(props.Tag.Text) != 0 {
165
+ value = props.Tag.Text[0].Text
166
+ }
167
+ if value == "" && props.Tag.Name != "uniqueItems" {
168
+ props.Report("no comment tag value")
169
+ return nil
170
+ }
171
+ return next(struct {
172
+ Report func(msg string) any
173
+ Value string
174
+ }{Report: props.Report, Value: value})
175
175
  }
176
176
 
177
177
  func (metadataCommentTagFactoryNamespace) Get(props struct {
178
- Kind string
179
- Type string
180
- Value string
178
+ Kind string
179
+ Type string
180
+ Value string
181
181
  }) []schemametadata.IMetadataTypeTag {
182
- parser := metadataCommentTagFactory_PARSER[props.Kind]
183
- var output []schemametadata.IMetadataTypeTag
184
- if parser != nil {
185
- output = parser(struct {
186
- Report func(msg string) any
187
- Value string
188
- }{
189
- Report: func(msg string) any { return nil },
190
- Value: props.Value,
191
- })[props.Type]
192
- }
193
- if output == nil {
194
- panic("no tag found for (kind: " + props.Kind + ", type: " + props.Type + ").")
195
- }
196
- return output
182
+ parser := metadataCommentTagFactory_PARSER[props.Kind]
183
+ var output []schemametadata.IMetadataTypeTag
184
+ if parser != nil {
185
+ output = parser(struct {
186
+ Report func(msg string) any
187
+ Value string
188
+ }{
189
+ Report: func(msg string) any { return nil },
190
+ Value: props.Value,
191
+ })[props.Type]
192
+ }
193
+ if output == nil {
194
+ panic("no tag found for (kind: " + props.Kind + ", type: " + props.Type + ").")
195
+ }
196
+ return output
197
197
  }
198
198
 
199
199
  var metadataCommentTagFactory_PARSER = map[string]metadataCommentTagFactory_parser{
200
- "items": func(props struct {
201
- Report func(msg string) any
202
- Value string
203
- }) metadataCommentTagFactory_TagRecord {
204
- value := metadataCommentTagFactory_parse_integer(struct {
205
- Report func(msg string) any
206
- Unsigned bool
207
- Value string
208
- }{Report: props.Report, Value: props.Value, Unsigned: true})
209
- return metadataCommentTagFactory_TagRecord{"array": {
210
- {Name: "MinItems<" + props.Value + ">", Target: "array", Kind: "minItems", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minItems": value}},
211
- {Name: "MaxItems<" + props.Value + ">", Target: "array", Kind: "maxItems", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxItems": value}},
212
- }}
213
- },
214
- "minItems": func(props struct {
215
- Report func(msg string) any
216
- Value string
217
- }) metadataCommentTagFactory_TagRecord {
218
- value := metadataCommentTagFactory_parse_integer(struct {
219
- Report func(msg string) any
220
- Unsigned bool
221
- Value string
222
- }{Report: props.Report, Value: props.Value, Unsigned: true})
223
- return metadataCommentTagFactory_TagRecord{"array": {{Name: "MinItems<" + props.Value + ">", Target: "array", Kind: "minItems", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minItems": value}}}}
224
- },
225
- "maxItems": func(props struct {
226
- Report func(msg string) any
227
- Value string
228
- }) metadataCommentTagFactory_TagRecord {
229
- value := metadataCommentTagFactory_parse_integer(struct {
230
- Report func(msg string) any
231
- Unsigned bool
232
- Value string
233
- }{Report: props.Report, Value: props.Value, Unsigned: true})
234
- return metadataCommentTagFactory_TagRecord{"array": {{Name: "MaxItems<" + props.Value + ">", Target: "array", Kind: "maxItems", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxItems": value}}}}
235
- },
236
- "uniqueItems": func(props struct {
237
- Report func(msg string) any
238
- Value string
239
- }) metadataCommentTagFactory_TagRecord {
240
- return metadataCommentTagFactory_TagRecord{"array": {{Name: "UniqueItems", Target: "array", Kind: "uniqueItems", Value: true, Validate: "$input.length <= 1 || (new Set($input).size === $input.length)", Exclusive: true, Schema: map[string]any{"uniqueItems": true}}}}
241
- },
242
- "type": metadataCommentTagFactory_parse_type,
243
- "minimum": func(props struct {
244
- Report func(msg string) any
245
- Value string
246
- }) metadataCommentTagFactory_TagRecord {
247
- return metadataCommentTagFactory_numeric(props, "Minimum", "minimum", props.Value+" <= $input", props.Value+" <= $input", []string{"minimum", "exclusiveMinimum"})
248
- },
249
- "maximum": func(props struct {
250
- Report func(msg string) any
251
- Value string
252
- }) metadataCommentTagFactory_TagRecord {
253
- return metadataCommentTagFactory_numeric(props, "Maximum", "maximum", "$input <= "+props.Value, "$input <= "+props.Value, []string{"maximum", "exclusiveMaximum"})
254
- },
255
- "exclusiveMinimum": func(props struct {
256
- Report func(msg string) any
257
- Value string
258
- }) metadataCommentTagFactory_TagRecord {
259
- return metadataCommentTagFactory_numeric(props, "ExclusiveMinimum", "exclusiveMinimum", props.Value+" < $input", props.Value+" < $input", []string{"minimum", "exclusiveMinimum"})
260
- },
261
- "exclusiveMaximum": func(props struct {
262
- Report func(msg string) any
263
- Value string
264
- }) metadataCommentTagFactory_TagRecord {
265
- return metadataCommentTagFactory_numeric(props, "ExclusiveMaximum", "exclusiveMaximum", "$input < "+props.Value, "$input < "+props.Value, []string{"maximum", "exclusiveMaximum"})
266
- },
267
- "multipleOf": func(props struct {
268
- Report func(msg string) any
269
- Value string
270
- }) metadataCommentTagFactory_TagRecord {
271
- return metadataCommentTagFactory_numeric(props, "MultipleOf", "multipleOf", "$input % "+props.Value+" === 0", "$input % "+props.Value+"n === 0n", true)
272
- },
273
- "format": func(props struct {
274
- Report func(msg string) any
275
- Value string
276
- }) metadataCommentTagFactory_TagRecord {
277
- matched, ok := metadataCommentTagFactory_FORMATS[props.Value]
278
- if ok == false {
279
- return metadataCommentTagFactory_TagRecord{}
280
- }
281
- return metadataCommentTagFactory_TagRecord{"string": {{Name: "Format<" + strconv.Quote(matched[0]) + ">", Target: "string", Kind: "format", Value: matched[0], Validate: matched[1], Exclusive: true, Schema: map[string]any{"format": matched[0]}}}}
282
- },
283
- "pattern": func(props struct {
284
- Report func(msg string) any
285
- Value string
286
- }) metadataCommentTagFactory_TagRecord {
287
- return metadataCommentTagFactory_TagRecord{"string": {{Name: "Pattern<" + strconv.Quote(props.Value) + ">", Target: "string", Kind: "pattern", Value: props.Value, Validate: "RegExp(" + strconv.Quote(props.Value) + ").test($input)", Exclusive: []string{"format"}, Schema: map[string]any{"pattern": props.Value}}}}
288
- },
289
- "length": func(props struct {
290
- Report func(msg string) any
291
- Value string
292
- }) metadataCommentTagFactory_TagRecord {
293
- value := metadataCommentTagFactory_parse_number(props)
294
- return metadataCommentTagFactory_TagRecord{"string": {
295
- {Name: "MinLength<" + props.Value + ">", Target: "string", Kind: "minLength", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minLength": value}},
296
- {Name: "MaxLength<" + props.Value + ">", Target: "string", Kind: "maxLength", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxLength": value}},
297
- }}
298
- },
299
- "minLength": func(props struct {
300
- Report func(msg string) any
301
- Value string
302
- }) metadataCommentTagFactory_TagRecord {
303
- value := metadataCommentTagFactory_parse_number(props)
304
- return metadataCommentTagFactory_TagRecord{"string": {{Name: "MinLength<" + props.Value + ">", Target: "string", Kind: "minLength", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minLength": value}}}}
305
- },
306
- "maxLength": func(props struct {
307
- Report func(msg string) any
308
- Value string
309
- }) metadataCommentTagFactory_TagRecord {
310
- value := metadataCommentTagFactory_parse_number(props)
311
- return metadataCommentTagFactory_TagRecord{"string": {{Name: "MaxLength<" + props.Value + ">", Target: "string", Kind: "maxLength", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxLength": value}}}}
312
- },
200
+ "items": func(props struct {
201
+ Report func(msg string) any
202
+ Value string
203
+ }) metadataCommentTagFactory_TagRecord {
204
+ value := metadataCommentTagFactory_parse_integer(struct {
205
+ Report func(msg string) any
206
+ Unsigned bool
207
+ Value string
208
+ }{Report: props.Report, Value: props.Value, Unsigned: true})
209
+ return metadataCommentTagFactory_TagRecord{"array": {
210
+ {Name: "MinItems<" + props.Value + ">", Target: "array", Kind: "minItems", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minItems": value}},
211
+ {Name: "MaxItems<" + props.Value + ">", Target: "array", Kind: "maxItems", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxItems": value}},
212
+ }}
213
+ },
214
+ "minItems": func(props struct {
215
+ Report func(msg string) any
216
+ Value string
217
+ }) metadataCommentTagFactory_TagRecord {
218
+ value := metadataCommentTagFactory_parse_integer(struct {
219
+ Report func(msg string) any
220
+ Unsigned bool
221
+ Value string
222
+ }{Report: props.Report, Value: props.Value, Unsigned: true})
223
+ return metadataCommentTagFactory_TagRecord{"array": {{Name: "MinItems<" + props.Value + ">", Target: "array", Kind: "minItems", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minItems": value}}}}
224
+ },
225
+ "maxItems": func(props struct {
226
+ Report func(msg string) any
227
+ Value string
228
+ }) metadataCommentTagFactory_TagRecord {
229
+ value := metadataCommentTagFactory_parse_integer(struct {
230
+ Report func(msg string) any
231
+ Unsigned bool
232
+ Value string
233
+ }{Report: props.Report, Value: props.Value, Unsigned: true})
234
+ return metadataCommentTagFactory_TagRecord{"array": {{Name: "MaxItems<" + props.Value + ">", Target: "array", Kind: "maxItems", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxItems": value}}}}
235
+ },
236
+ "uniqueItems": func(props struct {
237
+ Report func(msg string) any
238
+ Value string
239
+ }) metadataCommentTagFactory_TagRecord {
240
+ return metadataCommentTagFactory_TagRecord{"array": {{Name: "UniqueItems", Target: "array", Kind: "uniqueItems", Value: true, Validate: "$input.length <= 1 || (new Set($input).size === $input.length)", Exclusive: true, Schema: map[string]any{"uniqueItems": true}}}}
241
+ },
242
+ "type": metadataCommentTagFactory_parse_type,
243
+ "minimum": func(props struct {
244
+ Report func(msg string) any
245
+ Value string
246
+ }) metadataCommentTagFactory_TagRecord {
247
+ return metadataCommentTagFactory_numeric(props, "Minimum", "minimum", props.Value+" <= $input", props.Value+" <= $input", []string{"minimum", "exclusiveMinimum"})
248
+ },
249
+ "maximum": func(props struct {
250
+ Report func(msg string) any
251
+ Value string
252
+ }) metadataCommentTagFactory_TagRecord {
253
+ return metadataCommentTagFactory_numeric(props, "Maximum", "maximum", "$input <= "+props.Value, "$input <= "+props.Value, []string{"maximum", "exclusiveMaximum"})
254
+ },
255
+ "exclusiveMinimum": func(props struct {
256
+ Report func(msg string) any
257
+ Value string
258
+ }) metadataCommentTagFactory_TagRecord {
259
+ return metadataCommentTagFactory_numeric(props, "ExclusiveMinimum", "exclusiveMinimum", props.Value+" < $input", props.Value+" < $input", []string{"minimum", "exclusiveMinimum"})
260
+ },
261
+ "exclusiveMaximum": func(props struct {
262
+ Report func(msg string) any
263
+ Value string
264
+ }) metadataCommentTagFactory_TagRecord {
265
+ return metadataCommentTagFactory_numeric(props, "ExclusiveMaximum", "exclusiveMaximum", "$input < "+props.Value, "$input < "+props.Value, []string{"maximum", "exclusiveMaximum"})
266
+ },
267
+ "multipleOf": func(props struct {
268
+ Report func(msg string) any
269
+ Value string
270
+ }) metadataCommentTagFactory_TagRecord {
271
+ return metadataCommentTagFactory_numeric(props, "MultipleOf", "multipleOf", "$input % "+props.Value+" === 0", "$input % "+props.Value+"n === 0n", true)
272
+ },
273
+ "format": func(props struct {
274
+ Report func(msg string) any
275
+ Value string
276
+ }) metadataCommentTagFactory_TagRecord {
277
+ matched, ok := metadataCommentTagFactory_FORMATS[props.Value]
278
+ if ok == false {
279
+ return metadataCommentTagFactory_TagRecord{}
280
+ }
281
+ return metadataCommentTagFactory_TagRecord{"string": {{Name: "Format<" + strconv.Quote(matched[0]) + ">", Target: "string", Kind: "format", Value: matched[0], Validate: matched[1], Exclusive: true, Schema: map[string]any{"format": matched[0]}}}}
282
+ },
283
+ "pattern": func(props struct {
284
+ Report func(msg string) any
285
+ Value string
286
+ }) metadataCommentTagFactory_TagRecord {
287
+ return metadataCommentTagFactory_TagRecord{"string": {{Name: "Pattern<" + strconv.Quote(props.Value) + ">", Target: "string", Kind: "pattern", Value: props.Value, Validate: "RegExp(" + strconv.Quote(props.Value) + ").test($input)", Exclusive: []string{"format"}, Schema: map[string]any{"pattern": props.Value}}}}
288
+ },
289
+ "length": func(props struct {
290
+ Report func(msg string) any
291
+ Value string
292
+ }) metadataCommentTagFactory_TagRecord {
293
+ value := metadataCommentTagFactory_parse_number(props)
294
+ return metadataCommentTagFactory_TagRecord{"string": {
295
+ {Name: "MinLength<" + props.Value + ">", Target: "string", Kind: "minLength", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minLength": value}},
296
+ {Name: "MaxLength<" + props.Value + ">", Target: "string", Kind: "maxLength", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxLength": value}},
297
+ }}
298
+ },
299
+ "minLength": func(props struct {
300
+ Report func(msg string) any
301
+ Value string
302
+ }) metadataCommentTagFactory_TagRecord {
303
+ value := metadataCommentTagFactory_parse_number(props)
304
+ return metadataCommentTagFactory_TagRecord{"string": {{Name: "MinLength<" + props.Value + ">", Target: "string", Kind: "minLength", Value: value, Validate: props.Value + " <= $input.length", Exclusive: true, Schema: map[string]any{"minLength": value}}}}
305
+ },
306
+ "maxLength": func(props struct {
307
+ Report func(msg string) any
308
+ Value string
309
+ }) metadataCommentTagFactory_TagRecord {
310
+ value := metadataCommentTagFactory_parse_number(props)
311
+ return metadataCommentTagFactory_TagRecord{"string": {{Name: "MaxLength<" + props.Value + ">", Target: "string", Kind: "maxLength", Value: value, Validate: "$input.length <= " + props.Value, Exclusive: true, Schema: map[string]any{"maxLength": value}}}}
312
+ },
313
313
  }
314
314
 
315
315
  func metadataCommentTagFactory_parse_type(props struct {
316
- Report func(msg string) any
317
- Value string
316
+ Report func(msg string) any
317
+ Value string
318
318
  }) metadataCommentTagFactory_TagRecord {
319
- value := props.Value
320
- if strings.HasPrefix(value, "{") && strings.HasSuffix(value, "}") {
321
- value = value[1 : len(value)-1]
322
- }
323
- if value == "int" {
324
- value = "int32"
325
- } else if value == "uint" {
326
- value = "uint32"
327
- }
328
- if metadataCommentTagFactory_includes([]string{"int32", "uint32", "int64", "uint64", "float", "double"}, value) == false {
329
- return metadataCommentTagFactory_TagRecord{}
330
- }
331
- validate := "true"
332
- if value == "int32" {
333
- validate = "Math.floor($input) === $input && -2147483648 <= $input && $input <= 2147483647"
334
- } else if value == "uint32" {
335
- validate = "Math.floor($input) === $input && 0 <= $input && $input <= 4294967295"
336
- } else if value == "int64" {
337
- validate = "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807"
338
- } else if value == "uint64" {
339
- validate = "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615"
340
- } else if value == "float" {
341
- validate = "-1.175494351e38 <= $input && $input <= 3.4028235e38"
342
- }
343
- var numberSchema any
344
- if value == "int32" || value == "int64" {
345
- numberSchema = map[string]any{"type": "integer"}
346
- } else if value == "uint32" || value == "uint64" {
347
- numberSchema = map[string]any{"type": "integer", "minimum": 0}
348
- }
349
- var bigintSchema any
350
- if value == "uint64" {
351
- bigintSchema = map[string]any{"minimum": 0}
352
- }
353
- return metadataCommentTagFactory_TagRecord{
354
- "number": {{Name: "Type<" + strconv.Quote(value) + ">", Target: "number", Kind: "type", Value: value, Validate: validate, Exclusive: true, Schema: numberSchema}},
355
- "bigint": {{Name: "Type<" + strconv.Quote(value) + ">", Target: "bigint", Kind: "type", Value: value, Validate: map[bool]string{true: "true", false: "BigInt(0) <= $input"}[value == "int64"], Exclusive: true, Schema: bigintSchema}},
356
- }
319
+ value := props.Value
320
+ if strings.HasPrefix(value, "{") && strings.HasSuffix(value, "}") {
321
+ value = value[1 : len(value)-1]
322
+ }
323
+ if value == "int" {
324
+ value = "int32"
325
+ } else if value == "uint" {
326
+ value = "uint32"
327
+ }
328
+ if metadataCommentTagFactory_includes([]string{"int32", "uint32", "int64", "uint64", "float", "double"}, value) == false {
329
+ return metadataCommentTagFactory_TagRecord{}
330
+ }
331
+ validate := "true"
332
+ if value == "int32" {
333
+ validate = "Math.floor($input) === $input && -2147483648 <= $input && $input <= 2147483647"
334
+ } else if value == "uint32" {
335
+ validate = "Math.floor($input) === $input && 0 <= $input && $input <= 4294967295"
336
+ } else if value == "int64" {
337
+ validate = "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807"
338
+ } else if value == "uint64" {
339
+ validate = "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615"
340
+ } else if value == "float" {
341
+ validate = "-1.175494351e38 <= $input && $input <= 3.4028235e38"
342
+ }
343
+ var numberSchema any
344
+ if value == "int32" || value == "int64" {
345
+ numberSchema = map[string]any{"type": "integer"}
346
+ } else if value == "uint32" || value == "uint64" {
347
+ numberSchema = map[string]any{"type": "integer", "minimum": 0}
348
+ }
349
+ var bigintSchema any
350
+ if value == "uint64" {
351
+ bigintSchema = map[string]any{"minimum": 0}
352
+ }
353
+ return metadataCommentTagFactory_TagRecord{
354
+ "number": {{Name: "Type<" + strconv.Quote(value) + ">", Target: "number", Kind: "type", Value: value, Validate: validate, Exclusive: true, Schema: numberSchema}},
355
+ "bigint": {{Name: "Type<" + strconv.Quote(value) + ">", Target: "bigint", Kind: "type", Value: value, Validate: map[bool]string{true: "true", false: "BigInt(0) <= $input"}[value == "int64"], Exclusive: true, Schema: bigintSchema}},
356
+ }
357
357
  }
358
358
 
359
359
  func metadataCommentTagFactory_numeric(props struct {
360
- Report func(msg string) any
361
- Value string
360
+ Report func(msg string) any
361
+ Value string
362
362
  }, name string, kind string, numberValidate string, bigintValidate string, exclusive any) metadataCommentTagFactory_TagRecord {
363
- number := metadataCommentTagFactory_parse_number(props)
364
- integer := metadataCommentTagFactory_parse_integer(struct {
365
- Report func(msg string) any
366
- Unsigned bool
367
- Value string
368
- }{Report: props.Report, Value: props.Value, Unsigned: false})
369
- var bigint any
370
- if integer != nil {
371
- bigint = int64(*integer)
372
- }
373
- return metadataCommentTagFactory_TagRecord{
374
- "number": {{Name: name + "<" + props.Value + ">", Target: "number", Kind: kind, Value: number, Validate: numberValidate, Exclusive: exclusive, Schema: map[string]any{kind: number}}},
375
- "bigint": {{Name: name + "<" + props.Value + "n>", Target: "bigint", Kind: kind, Value: bigint, Validate: bigintValidate, Exclusive: exclusive, Schema: map[string]any{kind: number}}},
376
- }
363
+ number := metadataCommentTagFactory_parse_number(props)
364
+ integer := metadataCommentTagFactory_parse_integer(struct {
365
+ Report func(msg string) any
366
+ Unsigned bool
367
+ Value string
368
+ }{Report: props.Report, Value: props.Value, Unsigned: false})
369
+ var bigint any
370
+ if integer != nil {
371
+ bigint = int64(*integer)
372
+ }
373
+ return metadataCommentTagFactory_TagRecord{
374
+ "number": {{Name: name + "<" + props.Value + ">", Target: "number", Kind: kind, Value: number, Validate: numberValidate, Exclusive: exclusive, Schema: map[string]any{kind: number}}},
375
+ "bigint": {{Name: name + "<" + props.Value + "n>", Target: "bigint", Kind: kind, Value: bigint, Validate: bigintValidate, Exclusive: exclusive, Schema: map[string]any{kind: number}}},
376
+ }
377
377
  }
378
378
 
379
379
  func metadataCommentTagFactory_parse_number(props struct {
380
- Report func(msg string) any
381
- Value string
380
+ Report func(msg string) any
381
+ Value string
382
382
  }) any {
383
- parsed, err := strconv.ParseFloat(props.Value, 64)
384
- if err != nil || math.IsNaN(parsed) {
385
- props.Report("invalid number")
386
- return nil
387
- }
388
- return parsed
383
+ parsed, err := strconv.ParseFloat(props.Value, 64)
384
+ if err != nil || math.IsNaN(parsed) {
385
+ props.Report("invalid number")
386
+ return nil
387
+ }
388
+ return parsed
389
389
  }
390
390
 
391
391
  func metadataCommentTagFactory_parse_integer(props struct {
392
- Report func(msg string) any
393
- Unsigned bool
394
- Value string
392
+ Report func(msg string) any
393
+ Unsigned bool
394
+ Value string
395
395
  }) *int {
396
- parsedAny := metadataCommentTagFactory_parse_number(struct {
397
- Report func(msg string) any
398
- Value string
399
- }{Report: props.Report, Value: props.Value})
400
- parsed, ok := parsedAny.(float64)
401
- if ok == false {
402
- return nil
403
- }
404
- if math.Floor(parsed) != parsed {
405
- props.Report("invalid integer")
406
- return nil
407
- }
408
- if props.Unsigned && parsed < 0 {
409
- props.Report("invalid unsigned integer")
410
- return nil
411
- }
412
- value := int(parsed)
413
- return &value
396
+ parsedAny := metadataCommentTagFactory_parse_number(struct {
397
+ Report func(msg string) any
398
+ Value string
399
+ }{Report: props.Report, Value: props.Value})
400
+ parsed, ok := parsedAny.(float64)
401
+ if ok == false {
402
+ return nil
403
+ }
404
+ if math.Floor(parsed) != parsed {
405
+ props.Report("invalid integer")
406
+ return nil
407
+ }
408
+ if props.Unsigned && parsed < 0 {
409
+ props.Report("invalid unsigned integer")
410
+ return nil
411
+ }
412
+ value := int(parsed)
413
+ return &value
414
414
  }
415
415
 
416
416
  var metadataCommentTagFactory_FORMATS = func() map[string][2]string {
417
- output := map[string][2]string{}
418
- for key, value := range FormatCheatSheet {
419
- output[key] = [2]string{key, value}
420
- }
421
- output["datetime"] = [2]string{"date-time", "!isNaN(new Date($input).getTime())"}
422
- output["dateTime"] = [2]string{"date-time", "!isNaN(new Date($input).getTime())"}
423
- return output
417
+ output := map[string][2]string{}
418
+ for key, value := range FormatCheatSheet {
419
+ output[key] = [2]string{key, value}
420
+ }
421
+ output["datetime"] = [2]string{"date-time", "!isNaN(new Date($input).getTime())"}
422
+ output["dateTime"] = [2]string{"date-time", "!isNaN(new Date($input).getTime())"}
423
+ return output
424
424
  }()
425
425
 
426
426
  func metadataCommentTagFactory_includes(values []string, target string) bool {
427
- for _, value := range values {
428
- if value == target {
429
- return true
430
- }
431
- }
432
- return false
427
+ for _, value := range values {
428
+ if value == target {
429
+ return true
430
+ }
431
+ }
432
+ return false
433
433
  }