typia 13.0.0-dev.20260430 → 13.0.0-dev.20260502-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/executable/TypiaGenerateWizard.js +55 -8
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard2.mjs +55 -8
- package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
- package/lib/executable/generate/ttsc.js.map +1 -1
- package/lib/executable/setup/PluginConfigurator.js.map +1 -1
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/transform.d.ts +2 -13
- package/lib/transform.js +4 -11
- package/lib/transform.js.map +1 -1
- package/lib/transform2.mjs +6 -14
- package/lib/transform2.mjs.map +1 -1
- package/native/adapter/adapter.go +128 -128
- package/native/adapter/cleanup.go +155 -172
- package/native/adapter/imports.go +80 -80
- package/native/adapter/visit.go +142 -142
- package/native/cmd/ttsc-typia/build.go +223 -223
- package/native/cmd/ttsc-typia/main.go +57 -57
- package/native/cmd/ttsc-typia/transform.go +421 -254
- package/native/cmd/ttsc-typia/transform_test.go +40 -0
- package/native/core/context/IProgrammerProps.go +7 -7
- package/native/core/context/ITransformOptions.go +5 -5
- package/native/core/context/ITypiaContext.go +13 -13
- package/native/core/context/TransformerError.go +81 -81
- package/native/core/factories/CommentFactory.go +9 -9
- package/native/core/factories/ExpressionFactory.go +254 -254
- package/native/core/factories/FormatCheatSheet.go +23 -23
- package/native/core/factories/IdentifierFactory.go +130 -130
- package/native/core/factories/JsonMetadataFactory.go +129 -129
- package/native/core/factories/LiteralFactory.go +195 -182
- package/native/core/factories/MetadataCommentTagFactory.go +379 -379
- package/native/core/factories/MetadataFactory.go +462 -462
- package/native/core/factories/MetadataTypeTagFactory.go +498 -498
- package/native/core/factories/MetadataTypeTagSchemaFactory.go +102 -102
- package/native/core/factories/NumericRangeFactory.go +84 -84
- package/native/core/factories/ProtobufFactory.go +933 -933
- package/native/core/factories/StatementFactory.go +72 -72
- package/native/core/factories/TemplateFactory.go +57 -57
- package/native/core/factories/TypeFactory.go +125 -125
- package/native/core/factories/ValueFactory.go +12 -12
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +35 -35
- package/native/core/factories/internal/metadata/MetadataHelper.go +176 -176
- package/native/core/factories/internal/metadata/emend_metadata_atomics.go +69 -69
- package/native/core/factories/internal/metadata/emplace_metadata_alias.go +27 -27
- package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +33 -33
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +209 -209
- package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +50 -50
- package/native/core/factories/internal/metadata/explore_metadata.go +29 -29
- package/native/core/factories/internal/metadata/iterate_metadata.go +46 -46
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +25 -25
- package/native/core/factories/internal/metadata/iterate_metadata_array.go +65 -65
- package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +49 -49
- package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +22 -22
- package/native/core/factories/internal/metadata/iterate_metadata_collection.go +228 -228
- package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +12 -12
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +71 -71
- package/native/core/factories/internal/metadata/iterate_metadata_escape.go +48 -48
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +82 -82
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +319 -319
- package/native/core/factories/internal/metadata/iterate_metadata_map.go +51 -51
- package/native/core/factories/internal/metadata/iterate_metadata_native.go +85 -85
- package/native/core/factories/internal/metadata/iterate_metadata_object.go +27 -27
- package/native/core/factories/internal/metadata/iterate_metadata_set.go +37 -37
- package/native/core/factories/internal/metadata/iterate_metadata_sort.go +137 -137
- package/native/core/factories/internal/metadata/iterate_metadata_template.go +33 -33
- package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +16 -16
- package/native/core/factories/internal/metadata/iterate_metadata_union.go +18 -18
- package/native/core/programmers/AssertProgrammer.go +389 -389
- package/native/core/programmers/ImportProgrammer.go +196 -196
- package/native/core/programmers/IsProgrammer.go +293 -293
- package/native/core/programmers/RandomProgrammer.go +1094 -1094
- package/native/core/programmers/ValidateProgrammer.go +369 -369
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +133 -133
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +104 -104
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +100 -100
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +79 -79
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +159 -159
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +99 -99
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +138 -138
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +222 -222
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +116 -116
- package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +36 -36
- package/native/core/programmers/helpers/AtomicPredicator.go +35 -35
- package/native/core/programmers/helpers/CloneJoiner.go +217 -217
- package/native/core/programmers/helpers/FunctionProgrammer.go +79 -79
- package/native/core/programmers/helpers/HttpMetadataUtil.go +17 -17
- package/native/core/programmers/helpers/ICheckEntry.go +5 -5
- package/native/core/programmers/helpers/IExpressionEntry.go +6 -6
- package/native/core/programmers/helpers/NotationJoiner.go +159 -159
- package/native/core/programmers/helpers/OptionPredicator.go +4 -4
- package/native/core/programmers/helpers/ProtobufUtil.go +231 -231
- package/native/core/programmers/helpers/ProtobufWire.go +6 -6
- package/native/core/programmers/helpers/PruneJoiner.go +227 -227
- package/native/core/programmers/helpers/RandomJoiner.go +155 -155
- package/native/core/programmers/helpers/StringifyJoinder.go +331 -331
- package/native/core/programmers/helpers/StringifyPredicator.go +10 -10
- package/native/core/programmers/helpers/UnionExplorer.go +835 -835
- package/native/core/programmers/helpers/UnionPredicator.go +78 -78
- package/native/core/programmers/helpers/disable_function_programmer_declare.go +6 -6
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +93 -93
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +42 -42
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +51 -51
- package/native/core/programmers/http/HttpFormDataProgrammer.go +351 -351
- package/native/core/programmers/http/HttpHeadersProgrammer.go +370 -370
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +109 -109
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +36 -36
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +45 -45
- package/native/core/programmers/http/HttpParameterProgrammer.go +158 -158
- package/native/core/programmers/http/HttpQueryProgrammer.go +422 -422
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +87 -87
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +39 -39
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +48 -48
- package/native/core/programmers/internal/CheckerProgrammer.go +1490 -1490
- package/native/core/programmers/internal/FeatureProgrammer.go +589 -589
- package/native/core/programmers/iterate/check_array_length.go +46 -46
- package/native/core/programmers/iterate/check_bigint.go +52 -52
- package/native/core/programmers/iterate/check_dynamic_key.go +220 -220
- package/native/core/programmers/iterate/check_dynamic_properties.go +245 -245
- package/native/core/programmers/iterate/check_everything.go +21 -21
- package/native/core/programmers/iterate/check_native.go +25 -25
- package/native/core/programmers/iterate/check_number.go +135 -135
- package/native/core/programmers/iterate/check_object.go +66 -66
- package/native/core/programmers/iterate/check_string.go +52 -52
- package/native/core/programmers/iterate/check_template.go +57 -57
- package/native/core/programmers/iterate/check_union_array_like.go +372 -372
- package/native/core/programmers/iterate/decode_union_object.go +118 -118
- package/native/core/programmers/iterate/feature_object_entries.go +134 -134
- package/native/core/programmers/iterate/json_schema_alias.go +52 -52
- package/native/core/programmers/iterate/json_schema_array.go +52 -52
- package/native/core/programmers/iterate/json_schema_bigint.go +8 -8
- package/native/core/programmers/iterate/json_schema_boolean.go +8 -8
- package/native/core/programmers/iterate/json_schema_constant.go +38 -38
- package/native/core/programmers/iterate/json_schema_description.go +12 -12
- package/native/core/programmers/iterate/json_schema_discriminator.go +47 -47
- package/native/core/programmers/iterate/json_schema_escaped.go +58 -58
- package/native/core/programmers/iterate/json_schema_jsDocTags.go +34 -34
- package/native/core/programmers/iterate/json_schema_native.go +43 -43
- package/native/core/programmers/iterate/json_schema_number.go +8 -8
- package/native/core/programmers/iterate/json_schema_object.go +149 -149
- package/native/core/programmers/iterate/json_schema_plugin.go +35 -35
- package/native/core/programmers/iterate/json_schema_station.go +211 -211
- package/native/core/programmers/iterate/json_schema_string.go +8 -8
- package/native/core/programmers/iterate/json_schema_template.go +53 -53
- package/native/core/programmers/iterate/json_schema_title.go +16 -16
- package/native/core/programmers/iterate/json_schema_tuple.go +34 -34
- package/native/core/programmers/iterate/metadata_to_pattern.go +53 -53
- package/native/core/programmers/iterate/postfix_of_tuple.go +5 -5
- package/native/core/programmers/iterate/prune_object_properties.go +85 -85
- package/native/core/programmers/iterate/stringify_dynamic_properties.go +193 -193
- package/native/core/programmers/iterate/stringify_native.go +1 -1
- package/native/core/programmers/iterate/stringify_regular_properties.go +84 -84
- package/native/core/programmers/iterate/template_to_pattern.go +20 -20
- package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +13 -13
- package/native/core/programmers/json/JsonApplicationProgrammer.go +323 -323
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +100 -100
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +88 -88
- package/native/core/programmers/json/JsonIsParseProgrammer.go +130 -130
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +92 -92
- package/native/core/programmers/json/JsonSchemaProgrammer.go +65 -65
- package/native/core/programmers/json/JsonSchemasProgrammer.go +116 -116
- package/native/core/programmers/json/JsonStringifyProgrammer.go +1245 -1245
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +89 -89
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +106 -106
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +449 -437
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +79 -79
- package/native/core/programmers/llm/LlmControllerProgrammer.go +35 -35
- package/native/core/programmers/llm/LlmMetadataFactory.go +74 -74
- package/native/core/programmers/llm/LlmParametersProgrammer.go +105 -132
- package/native/core/programmers/llm/LlmParseProgrammer.go +88 -88
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +780 -423
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +123 -123
- package/native/core/programmers/misc/MiscAssertCloneProgrammer.go +82 -82
- package/native/core/programmers/misc/MiscAssertPruneProgrammer.go +97 -97
- package/native/core/programmers/misc/MiscCloneProgrammer.go +1056 -1056
- package/native/core/programmers/misc/MiscIsCloneProgrammer.go +94 -94
- package/native/core/programmers/misc/MiscIsPruneProgrammer.go +86 -86
- package/native/core/programmers/misc/MiscLiteralsProgrammer.go +99 -99
- package/native/core/programmers/misc/MiscPruneProgrammer.go +700 -700
- package/native/core/programmers/misc/MiscValidateCloneProgrammer.go +103 -103
- package/native/core/programmers/misc/MiscValidatePruneProgrammer.go +94 -94
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +85 -85
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +1188 -1188
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +90 -90
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +109 -109
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +114 -114
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +697 -697
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1039 -1039
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +93 -93
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +228 -228
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +88 -88
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +120 -120
- package/native/core/schemas/metadata/IMetadataDictionary.go +4 -4
- package/native/core/schemas/metadata/MetadataAlias.go +15 -15
- package/native/core/schemas/metadata/MetadataAliasType.go +36 -36
- package/native/core/schemas/metadata/MetadataApplication.go +25 -25
- package/native/core/schemas/metadata/MetadataArray.go +15 -15
- package/native/core/schemas/metadata/MetadataArrayType.go +31 -31
- package/native/core/schemas/metadata/MetadataAtomic.go +45 -45
- package/native/core/schemas/metadata/MetadataCollection.go +380 -380
- package/native/core/schemas/metadata/MetadataComponents.go +95 -95
- package/native/core/schemas/metadata/MetadataConstant.go +31 -31
- package/native/core/schemas/metadata/MetadataConstantValue.go +63 -63
- package/native/core/schemas/metadata/MetadataEscaped.go +17 -17
- package/native/core/schemas/metadata/MetadataFunction.go +30 -30
- package/native/core/schemas/metadata/MetadataMap.go +21 -21
- package/native/core/schemas/metadata/MetadataNative.go +48 -48
- package/native/core/schemas/metadata/MetadataObject.go +15 -15
- package/native/core/schemas/metadata/MetadataObjectType.go +116 -116
- package/native/core/schemas/metadata/MetadataParameter.go +28 -28
- package/native/core/schemas/metadata/MetadataProperty.go +32 -32
- package/native/core/schemas/metadata/MetadataSchema.go +766 -766
- package/native/core/schemas/metadata/MetadataSet.go +17 -17
- package/native/core/schemas/metadata/MetadataTemplate.go +43 -43
- package/native/core/schemas/metadata/MetadataTuple.go +10 -10
- package/native/core/schemas/metadata/MetadataTupleType.go +38 -38
- package/native/core/schemas/protobuf/IProtobufProperty.go +2 -2
- package/native/core/schemas/protobuf/IProtobufPropertyType.go +18 -18
- package/native/core/schemas/protobuf/IProtobufSchema.go +17 -17
- package/native/core/typings/Writable.go +1 -1
- package/native/core/utils/PatternUtil.go +38 -38
- package/native/core/utils/ProtobufNameEncoder.go +28 -28
- package/native/shim/printer/shim.go +213 -213
- package/native/third_party/ttsc/driver/host.go +7 -7
- package/native/third_party/ttsc/driver/program.go +275 -275
- package/native/third_party/ttsc/driver/rewrite.go +219 -219
- package/native/third_party/ttsc/shim/ast/lint.go +171 -171
- package/native/third_party/ttsc/shim/ast/shim.go +83 -83
- package/native/third_party/ttsc/shim/bundled/shim.go +5 -1
- package/native/third_party/ttsc/shim/checker/shim.go +79 -79
- package/native/third_party/ttsc/shim/compiler/shim.go +16 -1
- package/native/third_party/ttsc/shim/core/shim.go +10 -10
- package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +79 -79
- package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +19 -19
- package/native/third_party/ttsc/shim/parser/shim.go +7 -1
- package/native/third_party/ttsc/shim/scanner/shim.go +39 -1
- package/native/third_party/ttsc/shim/tsoptions/shim.go +51 -1
- package/native/third_party/ttsc/shim/tspath/shim.go +72 -1
- package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/shim.go +4 -1
- package/native/transform/CallExpressionTransformer.go +556 -556
- package/native/transform/FileTransformer.go +123 -123
- package/native/transform/ImportTransformer.go +224 -224
- package/native/transform/NodeTransformer.go +11 -11
- package/native/transform/TypiaGenerator.go +136 -136
- package/native/transform/features/AssertTransformer.go +28 -28
- package/native/transform/features/CreateAssertTransformer.go +28 -28
- package/native/transform/features/CreateIsTransformer.go +24 -24
- package/native/transform/features/CreateRandomTransformer.go +35 -35
- package/native/transform/features/CreateValidateTransformer.go +24 -24
- package/native/transform/features/IsTransformer.go +24 -24
- package/native/transform/features/RandomTransformer.go +37 -37
- package/native/transform/features/ValidateTransformer.go +24 -24
- package/native/transform/features/functional/FunctionalGenericTransformer.go +48 -48
- package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpParameterTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpParameterTransformer.go +11 -11
- package/native/transform/features/http/HttpQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/json/JsonApplicationTransformer.go +61 -61
- package/native/transform/features/json/JsonAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +11 -11
- package/native/transform/features/json/JsonIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonSchemaTransformer.go +148 -148
- package/native/transform/features/json/JsonSchemasTransformer.go +94 -94
- package/native/transform/features/json/JsonStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateStringifyTransformer.go +11 -11
- package/native/transform/features/llm/LlmApplicationTransformer.go +43 -43
- package/native/transform/features/llm/LlmCoerceTransformer.go +50 -50
- package/native/transform/features/llm/LlmControllerTransformer.go +48 -48
- package/native/transform/features/llm/LlmCreateCoerceTransformer.go +43 -43
- package/native/transform/features/llm/LlmCreateParseTransformer.go +43 -43
- package/native/transform/features/llm/LlmParametersTransformer.go +38 -38
- package/native/transform/features/llm/LlmParseTransformer.go +50 -50
- package/native/transform/features/llm/LlmSchemaTransformer.go +129 -129
- package/native/transform/features/llm/LlmStructuredOutputTransformer.go +44 -44
- package/native/transform/features/misc/MiscAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscLiteralsTransformer.go +21 -21
- package/native/transform/features/misc/MiscPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidatePruneTransformer.go +11 -11
- package/native/transform/features/notations/NotationAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationGeneralTransformer.go +21 -21
- package/native/transform/features/notations/NotationIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationValidateGeneralTransformer.go +16 -16
- package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufMessageTransformer.go +20 -20
- package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +11 -11
- package/native/transform/features/reflect/ReflectMetadataTransformer.go +59 -59
- package/native/transform/features/reflect/ReflectNameTransformer.go +78 -78
- package/native/transform/features/reflect/ReflectSchemaTransformer.go +121 -121
- package/native/transform/features/reflect/ReflectSchemasTransformer.go +55 -55
- package/native/transform/internal/GenericTransformer.go +173 -173
- package/native/transform/transform.go +32 -32
- package/package.json +4 -4
- package/src/executable/TypiaGenerateWizard.ts +78 -9
- package/src/executable/generate/ttsc.ts +2 -3
- package/src/executable/setup/PluginConfigurator.ts +2 -3
- package/src/internal/_randomInteger.ts +5 -5
- package/src/internal/_validateReport.ts +1 -2
- package/src/transform.ts +6 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
package factories
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
"fmt"
|
|
5
|
+
"strings"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
type metadataTypeTagFactoryNamespace struct{}
|
|
@@ -12,549 +12,549 @@ type metadataTypeTagFactoryNamespace struct{}
|
|
|
12
12
|
var MetadataTypeTagFactory = metadataTypeTagFactoryNamespace{}
|
|
13
13
|
|
|
14
14
|
func (metadataTypeTagFactoryNamespace) Is(obj *schemametadata.MetadataObjectType) bool {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if obj == nil || len(obj.Properties) != 1 {
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
top := obj.Properties[0]
|
|
20
|
+
if top.Key.IsSoleLiteral() == false {
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
if literal := top.Key.GetSoleLiteral(); literal == nil || *literal != "typia.tag" {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
value := top.Value
|
|
28
|
+
if value.Size() != 1 ||
|
|
29
|
+
len(value.Objects) != 1 ||
|
|
30
|
+
value.IsRequired() == true ||
|
|
31
|
+
value.Nullable == true {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
tag := top.Value.Objects[0].Type
|
|
36
|
+
statics := []string{}
|
|
37
|
+
for _, property := range tag.Properties {
|
|
38
|
+
if str := property.Key.GetSoleLiteral(); str != nil {
|
|
39
|
+
statics = append(statics, *str)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for _, field := range metadataTypeTagFactory_ESSENTIAL_FIELDS {
|
|
43
|
+
if metadataTypeTagFactory_includes(statics, field) == false {
|
|
44
|
+
return false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
func (metadataTypeTagFactoryNamespace) Analyze(props struct {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
Errors *[]MetadataFactory_IError
|
|
52
|
+
Type string
|
|
53
|
+
Objects []*schemametadata.MetadataObjectType
|
|
54
|
+
Explore MetadataFactory_IExplore
|
|
55
55
|
}) []schemametadata.IMetadataTypeTag {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
messages := []string{}
|
|
57
|
+
report := func(next struct {
|
|
58
|
+
Property *string
|
|
59
|
+
Message string
|
|
60
|
+
}) bool {
|
|
61
|
+
property := "[\"typia.tag\"]"
|
|
62
|
+
if next.Property != nil {
|
|
63
|
+
property = "[\"typia.tag." + *next.Property + "\"]"
|
|
64
|
+
}
|
|
65
|
+
messages = append(messages, "the property "+property+" "+next.Message+".")
|
|
66
|
+
return false
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
filtered := []*schemametadata.MetadataObjectType{}
|
|
70
|
+
for _, obj := range props.Objects {
|
|
71
|
+
if len(obj.Properties) != 1 {
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
top := obj.Properties[0]
|
|
75
|
+
literal := top.Key.GetSoleLiteral()
|
|
76
|
+
if literal == nil ||
|
|
77
|
+
*literal != "typia.tag" ||
|
|
78
|
+
top.Value.Size() != 1 ||
|
|
79
|
+
len(top.Value.Objects) != 1 {
|
|
80
|
+
continue
|
|
81
|
+
}
|
|
82
|
+
if top.Value.Optional == false {
|
|
83
|
+
report(struct {
|
|
84
|
+
Property *string
|
|
85
|
+
Message string
|
|
86
|
+
}{Property: nil, Message: "must be optional object"})
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
90
|
+
tag := top.Value.Objects[0].Type
|
|
91
|
+
statistics := []string{}
|
|
92
|
+
for _, property := range tag.Properties {
|
|
93
|
+
if str := property.Key.GetSoleLiteral(); str != nil {
|
|
94
|
+
statistics = append(statistics, *str)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
missing := false
|
|
98
|
+
for _, field := range metadataTypeTagFactory_ESSENTIAL_FIELDS {
|
|
99
|
+
if metadataTypeTagFactory_includes(statistics, field) == false {
|
|
100
|
+
missing = true
|
|
101
|
+
break
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if missing {
|
|
105
|
+
report(struct {
|
|
106
|
+
Property *string
|
|
107
|
+
Message string
|
|
108
|
+
}{
|
|
109
|
+
Property: nil,
|
|
110
|
+
Message: "must have at least three properties - " + metadataTypeTagFactory_essentialFieldsMessage(),
|
|
111
|
+
})
|
|
112
|
+
continue
|
|
113
|
+
}
|
|
114
|
+
success := true
|
|
115
|
+
for _, property := range tag.Properties {
|
|
116
|
+
key := property.Key.GetSoleLiteral()
|
|
117
|
+
if key == nil {
|
|
118
|
+
continue
|
|
119
|
+
}
|
|
120
|
+
if metadataTypeTagFactory_includes(metadataTypeTagFactory_FIELDS, *key) == false {
|
|
121
|
+
continue
|
|
122
|
+
}
|
|
123
|
+
if metadataTypeTagFactory_validate_property(struct {
|
|
124
|
+
Report func(struct {
|
|
125
|
+
Property *string
|
|
126
|
+
Message string
|
|
127
|
+
}) bool
|
|
128
|
+
Key string
|
|
129
|
+
Value *schemametadata.MetadataSchema
|
|
130
|
+
}{
|
|
131
|
+
Report: report,
|
|
132
|
+
Key: *key,
|
|
133
|
+
Value: property.Value,
|
|
134
|
+
}) == false {
|
|
135
|
+
success = false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if success {
|
|
139
|
+
filtered = append(filtered, obj)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if len(filtered) == 0 {
|
|
143
|
+
return []schemametadata.IMetadataTypeTag{}
|
|
144
|
+
}
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
146
|
+
tagList := []*metadataTypeTagFactory_ITypeTag{}
|
|
147
|
+
for _, object := range filtered {
|
|
148
|
+
tagList = append(tagList, metadataTypeTagFactory_create_metadata_type_tag(struct {
|
|
149
|
+
Report func(struct {
|
|
150
|
+
Property *string
|
|
151
|
+
Message string
|
|
152
|
+
}) bool
|
|
153
|
+
Object *schemametadata.MetadataObjectType
|
|
154
|
+
}{
|
|
155
|
+
Report: report,
|
|
156
|
+
Object: object,
|
|
157
|
+
}))
|
|
158
|
+
}
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
160
|
+
output := []schemametadata.IMetadataTypeTag{}
|
|
161
|
+
for _, tag := range tagList {
|
|
162
|
+
if tag == nil {
|
|
163
|
+
continue
|
|
164
|
+
}
|
|
165
|
+
target := ""
|
|
166
|
+
if metadataTypeTagFactory_includes(tag.Target, props.Type) {
|
|
167
|
+
target = props.Type
|
|
168
|
+
}
|
|
169
|
+
output = append(output, schemametadata.IMetadataTypeTag{
|
|
170
|
+
Target: target,
|
|
171
|
+
Name: tag.Name,
|
|
172
|
+
Kind: tag.Kind,
|
|
173
|
+
Value: tag.Value,
|
|
174
|
+
Validate: tag.Validate[props.Type],
|
|
175
|
+
Exclusive: tag.Exclusive,
|
|
176
|
+
Schema: tag.Schema,
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
MetadataTypeTagFactory.Validate(struct {
|
|
180
|
+
Report func(struct {
|
|
181
|
+
Property *string
|
|
182
|
+
Message string
|
|
183
|
+
}) bool
|
|
184
|
+
Type string
|
|
185
|
+
Tags []schemametadata.IMetadataTypeTag
|
|
186
|
+
}{
|
|
187
|
+
Report: report,
|
|
188
|
+
Type: props.Type,
|
|
189
|
+
Tags: output,
|
|
190
|
+
})
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
192
|
+
if len(messages) > 0 {
|
|
193
|
+
if props.Errors != nil {
|
|
194
|
+
names := []string{props.Type}
|
|
195
|
+
for _, object := range props.Objects {
|
|
196
|
+
names = append(names, object.Name)
|
|
197
|
+
}
|
|
198
|
+
*props.Errors = append(*props.Errors, MetadataFactory_IError{
|
|
199
|
+
Name: strings.Join(names, " & "),
|
|
200
|
+
Explore: props.Explore,
|
|
201
|
+
Messages: messages,
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
return []schemametadata.IMetadataTypeTag{}
|
|
205
|
+
}
|
|
206
|
+
return output
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
func (metadataTypeTagFactoryNamespace) Validate(props struct {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
Report func(struct {
|
|
211
|
+
Property *string
|
|
212
|
+
Message string
|
|
213
|
+
}) bool
|
|
214
|
+
Type string
|
|
215
|
+
Tags []schemametadata.IMetadataTypeTag
|
|
216
216
|
}) bool {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
217
|
+
success := true
|
|
218
|
+
for _, tag := range props.Tags {
|
|
219
|
+
if tag.Target != props.Type {
|
|
220
|
+
if success {
|
|
221
|
+
success = props.Report(struct {
|
|
222
|
+
Property *string
|
|
223
|
+
Message string
|
|
224
|
+
}{Property: nil, Message: "target must contain " + props.Type + " type"})
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
229
|
+
for i, tag := range props.Tags {
|
|
230
|
+
switch exclusive := tag.Exclusive.(type) {
|
|
231
|
+
case bool:
|
|
232
|
+
if exclusive == false {
|
|
233
|
+
continue
|
|
234
|
+
}
|
|
235
|
+
some := false
|
|
236
|
+
for j, opposite := range props.Tags {
|
|
237
|
+
if i != j && opposite.Kind == tag.Kind {
|
|
238
|
+
some = true
|
|
239
|
+
break
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if some && success {
|
|
243
|
+
success = props.Report(struct {
|
|
244
|
+
Property *string
|
|
245
|
+
Message string
|
|
246
|
+
}{Property: nil, Message: "kind '" + tag.Kind + "' can't be duplicated"})
|
|
247
|
+
}
|
|
248
|
+
case []string:
|
|
249
|
+
var some *schemametadata.IMetadataTypeTag
|
|
250
|
+
for j, opposite := range props.Tags {
|
|
251
|
+
if i != j && opposite.Kind == tag.Kind && metadataTypeTagFactory_includes(exclusive, opposite.Name) {
|
|
252
|
+
copied := opposite
|
|
253
|
+
some = &copied
|
|
254
|
+
break
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if some != nil && success {
|
|
258
|
+
success = props.Report(struct {
|
|
259
|
+
Property *string
|
|
260
|
+
Message string
|
|
261
|
+
}{Property: nil, Message: "kind '" + tag.Kind + "' can't be used with '" + some.Name + "'"})
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return success
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
func metadataTypeTagFactory_validate_property(props struct {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
269
|
+
Report func(struct {
|
|
270
|
+
Property *string
|
|
271
|
+
Message string
|
|
272
|
+
}) bool
|
|
273
|
+
Key string
|
|
274
|
+
Value *schemametadata.MetadataSchema
|
|
275
275
|
}) bool {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
276
|
+
key := props.Key
|
|
277
|
+
property := &key
|
|
278
|
+
if props.Key == "target" && (len(props.Value.Constants) != 1 ||
|
|
279
|
+
len(props.Value.Constants[0].Values) != props.Value.Size() ||
|
|
280
|
+
metadataTypeTagFactory_some(props.Value.Constants[0].Values, func(v *schemametadata.MetadataConstantValue) bool {
|
|
281
|
+
str, ok := v.Value.(string)
|
|
282
|
+
return ok == false || metadataTypeTagFactory_includes([]string{"boolean", "bigint", "number", "string", "array", "object"}, str) == false
|
|
283
|
+
})) {
|
|
284
|
+
return props.Report(struct {
|
|
285
|
+
Property *string
|
|
286
|
+
Message string
|
|
287
|
+
}{Property: property, Message: "must be one of 'boolean', 'bigint', 'number', 'string', 'array', 'object'"})
|
|
288
|
+
}
|
|
289
|
+
if props.Key == "kind" && (props.Value.Size() != 1 ||
|
|
290
|
+
len(props.Value.Constants) != 1 ||
|
|
291
|
+
props.Value.Constants[0].Type != "string" ||
|
|
292
|
+
len(props.Value.Constants[0].Values) != 1) {
|
|
293
|
+
return props.Report(struct {
|
|
294
|
+
Property *string
|
|
295
|
+
Message string
|
|
296
|
+
}{Property: property, Message: "must be a string literal type"})
|
|
297
|
+
}
|
|
298
|
+
if props.Key == "value" && !((props.Value.Size() == 0 && props.Value.IsRequired() == false) ||
|
|
299
|
+
(props.Value.Size() == 1 && (len(props.Value.Objects) == 1 || len(props.Value.Constants) == 1))) {
|
|
300
|
+
return props.Report(struct {
|
|
301
|
+
Property *string
|
|
302
|
+
Message string
|
|
303
|
+
}{Property: property, Message: "must be a literal type or undefined value"})
|
|
304
|
+
}
|
|
305
|
+
if props.Key == "exclusive" {
|
|
306
|
+
return metadataTypeTagFactory_get_exclusive(struct {
|
|
307
|
+
Report func(struct {
|
|
308
|
+
Property *string
|
|
309
|
+
Message string
|
|
310
|
+
}) bool
|
|
311
|
+
Key string
|
|
312
|
+
Value *schemametadata.MetadataSchema
|
|
313
|
+
}{Report: props.Report, Key: props.Key, Value: props.Value}) != nil
|
|
314
|
+
}
|
|
315
|
+
if props.Key == "validate" {
|
|
316
|
+
if props.Value.Size() == 0 && props.Value.IsRequired() == false && props.Value.Nullable == false {
|
|
317
|
+
return true
|
|
318
|
+
}
|
|
319
|
+
if props.Value.Size() == 1 &&
|
|
320
|
+
len(props.Value.Constants) == 1 &&
|
|
321
|
+
props.Value.Constants[0].Type == "string" &&
|
|
322
|
+
len(props.Value.Constants[0].Values) == 1 {
|
|
323
|
+
return true
|
|
324
|
+
}
|
|
325
|
+
target := []string{}
|
|
326
|
+
if len(props.Value.Objects) == 0 {
|
|
327
|
+
targetProperty := "target"
|
|
328
|
+
return props.Report(struct {
|
|
329
|
+
Property *string
|
|
330
|
+
Message string
|
|
331
|
+
}{Property: &targetProperty, Message: "must be one of 'boolean', 'bigint', 'number', 'string', 'array', 'object"})
|
|
332
|
+
}
|
|
333
|
+
for _, property := range props.Value.Objects[0].Type.Properties {
|
|
334
|
+
if lit := property.Key.GetSoleLiteral(); lit != nil {
|
|
335
|
+
target = append(target, *lit)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
variadic := props.Value.Size() == 1 && len(props.Value.Objects) == 1
|
|
339
|
+
for _, vp := range props.Value.Objects[0].Type.Properties {
|
|
340
|
+
lit := vp.Key.GetSoleLiteral()
|
|
341
|
+
if !(vp.Value.Size() == 1 &&
|
|
342
|
+
vp.Value.IsRequired() &&
|
|
343
|
+
vp.Value.Nullable == false &&
|
|
344
|
+
len(vp.Value.Constants) == 1 &&
|
|
345
|
+
vp.Value.Constants[0].Type == "string" &&
|
|
346
|
+
len(vp.Value.Constants[0].Values) == 1 &&
|
|
347
|
+
lit != nil &&
|
|
348
|
+
metadataTypeTagFactory_includes(target, *lit)) {
|
|
349
|
+
variadic = false
|
|
350
|
+
break
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if variadic == false {
|
|
354
|
+
return props.Report(struct {
|
|
355
|
+
Property *string
|
|
356
|
+
Message string
|
|
357
|
+
}{Property: property, Message: "must be a string literal type or Record<Target, string> type."})
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return true
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
func metadataTypeTagFactory_create_metadata_type_tag(props struct {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
Report func(struct {
|
|
365
|
+
Property *string
|
|
366
|
+
Message string
|
|
367
|
+
}) bool
|
|
368
|
+
Object *schemametadata.MetadataObjectType
|
|
369
369
|
}) *metadataTypeTagFactory_ITypeTag {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
370
|
+
find := func(key string) *schemametadata.MetadataProperty {
|
|
371
|
+
if len(props.Object.Properties) == 0 ||
|
|
372
|
+
props.Object.Properties[0].Value == nil ||
|
|
373
|
+
len(props.Object.Properties[0].Value.Objects) == 0 {
|
|
374
|
+
return nil
|
|
375
|
+
}
|
|
376
|
+
for _, property := range props.Object.Properties[0].Value.Objects[0].Type.Properties {
|
|
377
|
+
if lit := property.Key.GetSoleLiteral(); lit != nil && *lit == key {
|
|
378
|
+
return property
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return nil
|
|
382
|
+
}
|
|
383
|
+
targetProperty := find("target")
|
|
384
|
+
if targetProperty == nil || len(targetProperty.Value.Constants) == 0 {
|
|
385
|
+
return nil
|
|
386
|
+
}
|
|
387
|
+
target := []string{}
|
|
388
|
+
for _, v := range targetProperty.Value.Constants[0].Values {
|
|
389
|
+
target = append(target, fmt.Sprint(v.Value))
|
|
390
|
+
}
|
|
391
|
+
kindProperty := find("kind")
|
|
392
|
+
if kindProperty == nil || len(kindProperty.Value.Constants) == 0 || len(kindProperty.Value.Constants[0].Values) == 0 {
|
|
393
|
+
return nil
|
|
394
|
+
}
|
|
395
|
+
kind := fmt.Sprint(kindProperty.Value.Constants[0].Values[0].Value)
|
|
396
396
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
397
|
+
var value any
|
|
398
|
+
if valueProperty := find("value"); valueProperty != nil && len(valueProperty.Value.Constants) != 0 && len(valueProperty.Value.Constants[0].Values) != 0 {
|
|
399
|
+
value = valueProperty.Value.Constants[0].Values[0].Value
|
|
400
|
+
}
|
|
401
|
+
exclusive := metadataTypeTagFactory_get_exclusive(struct {
|
|
402
|
+
Report func(struct {
|
|
403
|
+
Property *string
|
|
404
|
+
Message string
|
|
405
|
+
}) bool
|
|
406
|
+
Key string
|
|
407
|
+
Value *schemametadata.MetadataSchema
|
|
408
|
+
}{Report: props.Report, Key: "exclusive", Value: metadataTypeTagFactory_property_value(find("exclusive"))})
|
|
409
|
+
if exclusive == nil {
|
|
410
|
+
return nil
|
|
411
|
+
}
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
413
|
+
validate := map[string]string{}
|
|
414
|
+
validateProperty := find("validate")
|
|
415
|
+
if validateProperty != nil {
|
|
416
|
+
validateValue := validateProperty.Value
|
|
417
|
+
if validateValue.Size() == 0 {
|
|
418
|
+
validate = map[string]string{}
|
|
419
|
+
} else if len(validateValue.Constants) != 0 {
|
|
420
|
+
text := fmt.Sprint(validateValue.Constants[0].Values[0].Value)
|
|
421
|
+
for _, t := range target {
|
|
422
|
+
validate[t] = text
|
|
423
|
+
}
|
|
424
|
+
} else if len(validateValue.Objects) != 0 {
|
|
425
|
+
for _, property := range validateValue.Objects[0].Type.Properties {
|
|
426
|
+
if key := property.Key.GetSoleLiteral(); key != nil &&
|
|
427
|
+
len(property.Value.Constants) != 0 &&
|
|
428
|
+
len(property.Value.Constants[0].Values) != 0 {
|
|
429
|
+
validate[*key] = fmt.Sprint(property.Value.Constants[0].Values[0].Value)
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
434
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
435
|
+
var schema any
|
|
436
|
+
if property := find("schema"); property != nil {
|
|
437
|
+
p := property.Value
|
|
438
|
+
if p.Size() == 0 && p.IsRequired() == false {
|
|
439
|
+
schema = nil
|
|
440
|
+
} else if p.Size() == 1 && p.Nullable == false && p.IsRequired() == true && p.Any == false && len(p.Objects) != 0 {
|
|
441
|
+
schema = MetadataTypeTagSchemaFactory.Object(struct {
|
|
442
|
+
Report func(msg string) bool
|
|
443
|
+
Object *schemametadata.MetadataObjectType
|
|
444
|
+
}{
|
|
445
|
+
Report: func(message string) bool {
|
|
446
|
+
schemaProperty := "schema"
|
|
447
|
+
return props.Report(struct {
|
|
448
|
+
Property *string
|
|
449
|
+
Message string
|
|
450
|
+
}{Property: &schemaProperty, Message: message})
|
|
451
|
+
},
|
|
452
|
+
Object: p.Objects[0].Type,
|
|
453
|
+
})
|
|
454
|
+
} else {
|
|
455
|
+
schemaProperty := "schema"
|
|
456
|
+
props.Report(struct {
|
|
457
|
+
Property *string
|
|
458
|
+
Message string
|
|
459
|
+
}{Property: &schemaProperty, Message: "must be an object type"})
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return &metadataTypeTagFactory_ITypeTag{
|
|
463
|
+
Name: props.Object.Name,
|
|
464
|
+
Target: target,
|
|
465
|
+
Kind: kind,
|
|
466
|
+
Value: value,
|
|
467
|
+
Validate: validate,
|
|
468
|
+
Exclusive: exclusive,
|
|
469
|
+
Schema: schema,
|
|
470
|
+
}
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
func metadataTypeTagFactory_get_exclusive(props struct {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
474
|
+
Report func(struct {
|
|
475
|
+
Property *string
|
|
476
|
+
Message string
|
|
477
|
+
}) bool
|
|
478
|
+
Key string
|
|
479
|
+
Value *schemametadata.MetadataSchema
|
|
480
480
|
}) any {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
481
|
+
if props.Value == nil {
|
|
482
|
+
return false
|
|
483
|
+
}
|
|
484
|
+
if props.Value.Size() == 1 &&
|
|
485
|
+
len(props.Value.Constants) == 1 &&
|
|
486
|
+
props.Value.Constants[0].Type == "boolean" &&
|
|
487
|
+
len(props.Value.Constants[0].Values) == 1 {
|
|
488
|
+
return props.Value.Constants[0].Values[0].Value
|
|
489
|
+
}
|
|
490
|
+
if props.Value.Size() == 1 && len(props.Value.Tuples) == 1 {
|
|
491
|
+
output := []string{}
|
|
492
|
+
for _, elem := range props.Value.Tuples[0].Type.Elements {
|
|
493
|
+
if !(elem.Size() == 1 &&
|
|
494
|
+
len(elem.Constants) == 1 &&
|
|
495
|
+
elem.Constants[0].Type == "string" &&
|
|
496
|
+
len(elem.Constants[0].Values) == 1) {
|
|
497
|
+
property := props.Key
|
|
498
|
+
props.Report(struct {
|
|
499
|
+
Property *string
|
|
500
|
+
Message string
|
|
501
|
+
}{Property: &property, Message: "must a boolean literal type or a tuple of string literal types."})
|
|
502
|
+
return nil
|
|
503
|
+
}
|
|
504
|
+
output = append(output, fmt.Sprint(elem.Constants[0].Values[0].Value))
|
|
505
|
+
}
|
|
506
|
+
return output
|
|
507
|
+
}
|
|
508
|
+
property := props.Key
|
|
509
|
+
props.Report(struct {
|
|
510
|
+
Property *string
|
|
511
|
+
Message string
|
|
512
|
+
}{Property: &property, Message: "must a boolean literal type or a tuple of string literal types."})
|
|
513
|
+
return nil
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
type metadataTypeTagFactory_ITypeTag struct {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
517
|
+
Name string
|
|
518
|
+
Target []string
|
|
519
|
+
Kind string
|
|
520
|
+
Value any
|
|
521
|
+
Validate map[string]string
|
|
522
|
+
Exclusive any
|
|
523
|
+
Schema any
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
var metadataTypeTagFactory_ESSENTIAL_FIELDS = []string{"target", "kind", "value"}
|
|
527
527
|
var metadataTypeTagFactory_FIELDS = []string{"target", "kind", "value", "validate", "exclusive"}
|
|
528
528
|
|
|
529
529
|
func metadataTypeTagFactory_includes(values []string, target string) bool {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
530
|
+
for _, value := range values {
|
|
531
|
+
if value == target {
|
|
532
|
+
return true
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return false
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
func metadataTypeTagFactory_some[T any](values []T, pred func(T) bool) bool {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
539
|
+
for _, value := range values {
|
|
540
|
+
if pred(value) {
|
|
541
|
+
return true
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return false
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
func metadataTypeTagFactory_property_value(property *schemametadata.MetadataProperty) *schemametadata.MetadataSchema {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
548
|
+
if property == nil {
|
|
549
|
+
return nil
|
|
550
|
+
}
|
|
551
|
+
return property.Value
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
func metadataTypeTagFactory_essentialFieldsMessage() string {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
555
|
+
values := make([]string, 0, len(metadataTypeTagFactory_ESSENTIAL_FIELDS))
|
|
556
|
+
for _, field := range metadataTypeTagFactory_ESSENTIAL_FIELDS {
|
|
557
|
+
values = append(values, "'"+field+"'")
|
|
558
|
+
}
|
|
559
|
+
return strings.Join(values, ", ")
|
|
560
560
|
}
|