Skip to content

Custom Tag with target "object" does not emit its validate codeΒ #1757

@Ermad

Description

@Ermad

πŸ“ Summary

  • Typia Version: 11.03
  • Expected behavior: Make a custom TagBase validator for object target
  • Actual behavior: The validation is omitted for generated output

A custom TagBase validator with object target doesn't seem to output its validation code at all. Seems related to target object as just change the target causes it to function as expected.

⏯ Playground Link

https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoF+gUzgFlgA7AKJ8YUYBwIAeAGqoANgFcuHAB4wOfACZE+8kACMOUAHxwAvLkIA6ACr4AQqgIcJWFnFxQ8HGAC5aEPQArDgBjGGY3OABrfg0-GhB+IRExAgj3ADc5RT8ZBQ5WTLlgDVQ1PwADAHkg0JhLKI5EAgAKABJ+MHkYAEpLWXU8GAALOCNzNqw8xWIKwrgVEIUCYAyOPxFFVmIjQrZOOAAxYFk1KCJzAAVUWDRZF0j5JygAfRK-HX1DSJgIFBC3nE4J8DFBIpACDBAR9dKCWDs4AAyHhJYSicQSACMRjYKkgsDgIQgfEhhOGoSiZgQyDQlhCUA4ZQ4AElJMdToYCEYWj0mEA

πŸ’» Code occuring the bug

import typia from "typia";

type MinEntries<Value extends number> = tags.TagBase<{
  target: "object";
  kind: "minEntries";
  value: Value;
  validate: `Object.keys($input).length >= ${Value}`;
  exclusive: true;
}>;
 
type Filters = Partial<{
  user_id: number
  topic_id: number
  post_id: number
}> & MinEntries<1>

export const check = typia.createIs<Filters>();

The generated code will not apply the custom validation at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions