typia 15.2.0 → 15.2.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.
Files changed (31) hide show
  1. package/lib/internal/_stringLengthGte.d.ts +7 -3
  2. package/lib/internal/_stringLengthGte.js +9 -3
  3. package/lib/internal/_stringLengthGte.js.map +1 -1
  4. package/lib/internal/_stringLengthGte.mjs +8 -3
  5. package/lib/internal/_stringLengthGte.mjs.map +1 -1
  6. package/lib/internal/_stringLengthLte.d.ts +7 -3
  7. package/lib/internal/_stringLengthLte.js +9 -3
  8. package/lib/internal/_stringLengthLte.js.map +1 -1
  9. package/lib/internal/_stringLengthLte.mjs +8 -3
  10. package/lib/internal/_stringLengthLte.mjs.map +1 -1
  11. package/native/cmd/ttsc-typia/json_schema_recursive_array_alias_transform_test.go +79 -0
  12. package/native/core/context/ImportProgrammer.go +19 -9
  13. package/native/core/context/ImportProgrammerPattern.go +36 -0
  14. package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +4 -1
  15. package/native/core/programmers/RandomProgrammer.go +19 -14
  16. package/native/core/programmers/internal/CheckerProgrammer.go +13 -6
  17. package/native/core/programmers/iterate/check_string.go +41 -5
  18. package/native/core/programmers/iterate/check_string_pattern_test.go +91 -0
  19. package/native/core/programmers/iterate/check_template.go +4 -4
  20. package/native/core/programmers/iterate/json_schema_alias.go +22 -24
  21. package/native/core/programmers/iterate/json_schema_array.go +14 -10
  22. package/native/core/programmers/iterate/json_schema_array_names.go +113 -0
  23. package/native/core/programmers/iterate/json_schema_native.go +10 -3
  24. package/native/core/programmers/iterate/json_schema_recursive_array_identity_test.go +75 -0
  25. package/native/core/programmers/iterate/json_schema_recursive_array_ownership_test.go +112 -0
  26. package/native/core/programmers/iterate/json_schema_station.go +5 -1
  27. package/native/core/programmers/json/JsonSchemasProgrammer.go +1 -0
  28. package/native/core/programmers/random_programmer_array_schema_reference_test.go +53 -0
  29. package/package.json +3 -3
  30. package/src/internal/_stringLengthGte.ts +8 -3
  31. package/src/internal/_stringLengthLte.ts +8 -3
@@ -0,0 +1,53 @@
1
+ package programmers
2
+
3
+ import (
4
+ "reflect"
5
+ "testing"
6
+
7
+ iterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
8
+ )
9
+
10
+ // TestRandomProgrammerArraySchemaReference verifies random generation consumes
11
+ // the schema writer's selected recursive variant rather than the bare type name.
12
+ //
13
+ // A recursive array can have several constrained schema components; only the
14
+ // returned reference identifies the constraints of the current use.
15
+ //
16
+ // 1. Supply a decoy plain component and a referenced maximum-zero variant.
17
+ // 2. Resolve a variant with multiple alternative tag rows.
18
+ // 3. Preserve inline, external and unresolved schemas without inventing a target.
19
+ //
20
+ // @evidence contracts/testing.md#behavioral-verification Resolves authored component references and compares complete schema lists, including explicit zero bounds and alternatives, as consumed by the random generator.
21
+ // @evidence contracts/testing.md#independent-expectations A local reference selects its named component, not a similarly named unconstrained component; literal array schema maps establish the expected constraints.
22
+ // @evidence contracts/testing.md#distinguishing-cases Distinguishes plain versus constrained targets, zero bounds, one versus multiple rows, inline schemas, nil components, absent targets and external references.
23
+ // @evidence contracts/testing.md#execution-ownership pnpm test:go:native discovers this same-package unit test; it executes the schema consumer in memory with no compiler or product process.
24
+ func TestRandomProgrammerArraySchemaReference(t *testing.T) {
25
+ empty := iterate.JsonSchema{"type": "array", "maxItems": 0}
26
+ multiple := []iterate.JsonSchema{empty, {"type": "array", "minItems": 2}}
27
+ components := &iterate.OpenApi_IComponents{Schemas: map[string]iterate.JsonSchema{
28
+ "Tree": {"type": "array"}, "Tree-array": empty,
29
+ "Tree-array-1": {"oneOf": multiple},
30
+ }}
31
+ for _, sample := range []struct {
32
+ name string
33
+ schema iterate.JsonSchema
34
+ expected []iterate.JsonSchema
35
+ }{
36
+ {"selected tagged target", iterate.JsonSchema{"$ref": "#/components/schemas/Tree-array"}, []iterate.JsonSchema{empty}},
37
+ {"alternative rows", iterate.JsonSchema{"$ref": "#/components/schemas/Tree-array-1"}, multiple},
38
+ {"inline", empty, []iterate.JsonSchema{empty}},
39
+ {"missing", iterate.JsonSchema{"$ref": "#/components/schemas/Missing"}, []iterate.JsonSchema{{"$ref": "#/components/schemas/Missing"}}},
40
+ {"external", iterate.JsonSchema{"$ref": "other.json#/Tree-array"}, []iterate.JsonSchema{{"$ref": "other.json#/Tree-array"}}},
41
+ } {
42
+ t.Run(sample.name, func(t *testing.T) {
43
+ actual := randomProgrammer_array_schema_list(components, []iterate.JsonSchema{sample.schema})
44
+ if !reflect.DeepEqual(actual, sample.expected) {
45
+ t.Errorf("got %#v, want %#v", actual, sample.expected)
46
+ }
47
+ })
48
+ }
49
+ original := []iterate.JsonSchema{empty}
50
+ if !reflect.DeepEqual(randomProgrammer_array_schema_list(nil, original), original) {
51
+ t.Error("nil components changed inline schema")
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "15.2.0",
3
+ "version": "15.2.2",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -43,8 +43,8 @@
43
43
  "homepage": "https://typia.io",
44
44
  "dependencies": {
45
45
  "randexp": "^0.5.3",
46
- "@typia/interface": "^15.2.0",
47
- "@typia/utils": "^15.2.0"
46
+ "@typia/interface": "^15.2.2",
47
+ "@typia/utils": "^15.2.2"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "ttsc": ">=0.34.1"
@@ -1,15 +1,20 @@
1
1
  /**
2
2
  * Test whether a string has at least the given number of code points.
3
3
  *
4
- * Iteration stops as soon as the count is reached, so a long string is not
5
- * scanned to its end.
4
+ * Twice the requested minimum in UTF-16 units guarantees enough code points.
5
+ * Other inputs are counted only until the minimum is reached.
6
6
  *
7
- * @evidence contracts/common.md#principled-implementation The iterator is consumed only until the count reaches the requested minimum, which decides the lower bound without scanning the whole string; a minimum of zero is true at once.
7
+ * @evidence contracts/common.md#principled-implementation Each code point occupies at most two UTF-16 units, so code-unit length at least twice the minimum proves the code-point bound. Otherwise iteration stops at the minimum; nonpositive minima remain true and NaN remains false.
8
8
  * @evidence contracts/common.md#clear-and-simple-design One loop with an early return.
9
9
  * @evidence contracts/common.md#prohibited-implementation-shortcuts The unit is code points.
10
10
  * @evidence contracts/common.md#meaningful-documentation The doc states the early return and the code point unit.
11
+ * @evidence contracts/performance.md#efficient-algorithms The code-unit lower bound accepts in constant time without allocating an iterator; ambiguous inputs retain the bounded code-point walk and constant auxiliary space.
12
+ *
13
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each call depends on its own primitive string and bound; this predicate coordinates no repeated requests or shared computation.
14
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate retains no state or handles after returning; iteration and scalar counters are call-local.
11
15
  */
12
16
  export const _stringLengthGte = (value: string, length: number): boolean => {
17
+ if (value.length >= length * 2) return true;
13
18
  let count: number = 0;
14
19
  if (length <= count) return true;
15
20
  for (const _ch of value) if (length <= ++count) return true;
@@ -1,15 +1,20 @@
1
1
  /**
2
2
  * Test whether a string has at most the given number of code points.
3
3
  *
4
- * Iteration stops as soon as the count is exceeded, so a long string is not
5
- * scanned to its end.
4
+ * UTF-16 length decides inputs whose code units already fit the bound. Other
5
+ * inputs are counted only until the maximum is exceeded.
6
6
  *
7
- * @evidence contracts/common.md#principled-implementation The iterator is consumed until the count exceeds the maximum, which decides the upper bound without scanning past it; a negative maximum is false at once.
7
+ * @evidence contracts/common.md#principled-implementation Each code point occupies one or two UTF-16 units, so code-unit length at most the maximum proves the code-point bound. Otherwise iteration stops once the maximum is exceeded; negative and NaN maxima remain false.
8
8
  * @evidence contracts/common.md#clear-and-simple-design One loop with an early return.
9
9
  * @evidence contracts/common.md#prohibited-implementation-shortcuts The unit is code points.
10
10
  * @evidence contracts/common.md#meaningful-documentation The doc states the early return and the code point unit.
11
+ * @evidence contracts/performance.md#efficient-algorithms The code-unit upper bound accepts in constant time without allocating an iterator; ambiguous inputs retain the bounded code-point walk and constant auxiliary space.
12
+ *
13
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each call depends on its own primitive string and bound; this predicate coordinates no repeated requests or shared computation.
14
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate retains no state or handles after returning; iteration and scalar counters are call-local.
11
15
  */
12
16
  export const _stringLengthLte = (value: string, length: number): boolean => {
17
+ if (value.length <= length) return true;
13
18
  let count: number = 0;
14
19
  if (!(count <= length)) return false;
15
20
  for (const _ch of value) if (!(++count <= length)) return false;