typia icon indicating copy to clipboard operation
typia copied to clipboard

Typia validates object against old interace

Open alessandrosp opened this issue 1 year ago • 1 comments

📝 Summary

Write a short summary of the bug in here.

  • Typia Version: ^6.5.0
  • Expected behavior: Validate against current interface
  • Actual behavior: Validate against previous interface

Write detailed description in here:

I'm using typia.validate to validate an object. It was working fine until I made changes to the underlying interface. Now typia.validate is giving me an error but the error implies Typia is using the old interface (e.g., it's complaining a field that has been removed in the new interface is undefined).

💻 Code occuring the bug

import typia from "typia";

let validationResults: typia.IValidation<
        DescriptorResponseInterface
      > = typia.validate<DescriptorResponseInterface>(newQuestElement);

The old interface, I omitted most fields:

export interface DescriptorResponseInterface {
  must_have_quest_stage: null | string;
  must_not_have_quest_stage: null | string;
}

The new interface; note that must_have_quest_stage and must_not_have_quest_stage have been removed.

export interface DescriptorResponseInterface {
  must_have_quest_stages: string[];
  must_not_have_quest_stages: string[];
}

The error:

{
    "path": "$input.must_have_quest_stage",
    "expected": "(null | string)"
    "value": undefined
}

alessandrosp avatar Jul 30 '24 04:07 alessandrosp

Will you check whether newly compiled or not?

samchon avatar Jul 30 '24 05:07 samchon