Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement decorator-based validation API for typia class methods#1646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge4 commits intomaster
base:master
Choose a base branch
Loading
fromcopilot/fix-1586

Conversation

Copy link
Contributor

CopilotAI commentedAug 8, 2025
edited
Loading

This PR implements a decorator-based API that enables parameter validation for class methods using typia's type-checking capabilities.

Problem

Currently, typia only supports functional wrappers for method validation:

classUserService{findMany(query:UserQuery):UserQuery[]{return[query];}}// Must wrap methods manuallyconstservice=newUserService();constwrappedFindMany=typia.functional.assertEqualsParameters(service.findMany.bind(service));

This approach is verbose and doesn't integrate cleanly with class-based architectures.

Solution

This PR introduces decorator support that enables clean, declarative validation:

classUserService{    @typia.decorators.assertEquals()findMany(query:UserQuery):UserQuery[]{return[query];// Parameters are automatically validated}}

Implementation

  • Newsrc/decorators.ts module with decorator functions (assert,assertEquals,is,equals,validate,validateEquals)
  • Transformer integration viaCallExpressionTransformer to handletypia.decorators.* calls
  • Decorator transformer pipeline that generates validation decorator functions
  • Reuse of existing validation logic from the functional module

The decorators are transformed at compile-time to return proper TypeScript decorators that wrap methods with validation logic, maintaining typia's zero-runtime-overhead philosophy.

Fixes#1586


✨ Let Copilot coding agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: samchon <13158709+samchon@users.noreply.github.com>
samchon

This comment was marked as outdated.

Copy link
Owner

@samchonsamchon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@copilot Try agai please

Co-authored-by: samchon <13158709+samchon@users.noreply.github.com>
Copy link
ContributorAuthor

CopilotAI commentedAug 9, 2025

@copilot Try agai please

I've implemented the basic decorator transformer infrastructure but discovered the core issue: my decorators aren't being transformed because they're not properly integrated into the transformer pipeline.

The decorators module compiles but still throwsNoTransformConfigurationError because the decorator transformations aren't being invoked. I need to fix the transformer registration to handle decorator call expressions properly.

Current status (commit4a9faba):

  • ✅ Basic decorator transformer architecture implemented
  • ✅ Code builds successfully
  • ❌ Decorators still not actually transforming (throwing NoTransformConfigurationError)

Next step: Fix the transformer pipeline integration to actually invoke decorator transformations.

Co-authored-by: samchon <13158709+samchon@users.noreply.github.com>
CopilotAI changed the title[WIP] Decorator based usage for typia.functional.assertEqualsFunctionImplement decorator-based validation API for typia class methodsAug 9, 2025
CopilotAI requested a review fromsamchonAugust 9, 2025 14:03
Copilot finished work on behalf ofsamchonAugust 9, 2025 14:03
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@samchonsamchonAwaiting requested review from samchon

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Decorator based usage for typia.functional.assertEqualsFunction

2 participants

@samchon

[8]ページ先頭

©2009-2025 Movatter.jp