The GitHub Actions job "cargo in /rust/fory-core for rand - Update #1322130765" 
on fory.git/main has failed.
Run started by GitHub user dependabot[bot] (triggered by dependabot[bot]).

Head commit for run:
36e95bb996fb86cb6fbb2389b3b338c652cc9eea / Talha Amjad 
<[email protected]>
feat(compiler): Add JavaScript/TypeScript IDL code generation (#3394)

## Summary

Implements TypeScript code generation for Fory IDL within the
fory-compiler, converting FDL (Fory Definition Language) schema files
into pure TypeScript type definitions. Zero runtime dependencies, with
comprehensive test coverage (12/12 tests passing), supporting messages,
enums, unions, and all primitive types.

## Changes

### Core Implementation
- **compiler/fory_compiler/generators/typescript.py** - TypeScript code
generator extending BaseGenerator (365 lines)
- Generates type-safe TypeScript interfaces, enums, and discriminated
unions
  - Supports nested types, collections, and optional fields
  - Proper type mapping for all 25 FDL primitive kinds
  - Field name conversion (snake_case → camelCase)
- Registration helper function generation for Fory serialization
integration

- **compiler/fory_compiler/generators/__init__.py** - Registration of
TypeScriptGenerator in the compiler ecosystem

- **compiler/fory_compiler/cli.py** - Added --typescript_out CLI
argument for TypeScript code generation

- **compiler/fory_compiler/tests/test_typescript_codegen.py** - 12
golden codegen tests covering:
  - Enum and message generation
  - Nested types (messages and enums)
  - Discriminated unions
  - All primitive type mappings
  - Collection types (arrays, maps)
  - Field naming conventions
  - File structure and licensing
  - Zero runtime dependencies validation

### Features
- **Message-to-Interface Generation**: Auto-converts FDL messages to
TypeScript interfaces
- **Enum Support**: Generates TypeScript enums with proper value
stripping and type IDs
- **Discriminated Unions**: Creates union types with discriminator enums
for type safety
- **Type Mappings**: Full support for all FDL primitives (bool→boolean,
int32→number, int64→bigint|number, float/double→number, etc.)
- **Nested Types**: Supports nested messages and enums within parent
types
- **Collection Types**: Arrays (repeated fields) and maps with type-safe
generics
- **Zero Runtime Dependencies**: Pure TypeScript type definitions, no
gRPC or external imports
- **Field Naming**: Automatic conversion to camelCase per TypeScript
conventions
- **Package/Module Handling**: Uses last segment of package name for
module name and registration functions
- **License Headers**: All generated files include Apache 2.0 license
headers
- **Registration Helpers**: Generates registration functions for Fory
serialization framework integration

### AI Assistance Checklist
- [x] Substantial AI assistance was used in this PR (yes)
- [x] I included the standardized AI Usage Disclosure block below
- [x] I can explain and defend all important changes without AI help
- [x] I reviewed AI-assisted code changes line by line before submission
- [x] I ran adequate human verification and recorded evidence (local/CI
checks, pass/fail summary, and review confirmation)
- [x] I added/updated tests and specs where required
- [x] I validated protocol/performance impacts with evidence when
applicable
- [x] I verified licensing and provenance compliance

AI Usage Disclosure
- substantial_ai_assistance: yes
- scope: <design drafting | code drafting>
- affected_files_or_subsystems: <high-level paths/modules>
- human_verification: <checks run locally or in CI + pass/fail summary +
contributor reviewed results>
- performance_verification: <N/A>
- provenance_license_confirmation: <Apache-2.0-compatible provenance
confirmed; no incompatible third-party code introduced>

### AI Review Evidence
#### General AI Review
Initial Review
• Identified issues in decimal type mapping, array type precedence, tag
id drop, and traversalContainer doesn't traverse union cases
Fixes Applied
• Updated DECIMAL mapping to string to avoid precision loss
• fix array type precedence issue.
• tag id drop prevention for id ==
0
• Aligned map type documentation with generated output
Final Review (Fresh Session)
• Re reviewed updated changes
• All issues resolved
• All tests pass. No
actionable issues remain

#### Fory-Specific AI Review
Scope
• Reviewed serialization and deserialization logic
• Verified typeInfo
handling, struct embedding, and reference tracking
• Checked alignment with Java reference implementation
• Validated cross
language compatibility and code generation
Result
• No actionable issues found

• Implementation aligns with Fory wire format and runtime behavior

Fixes #3280

---------

Co-authored-by: Shawn Yang <[email protected]>

Report URL: https://github.com/apache/fory/actions/runs/24380111767

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to