Skip to content
New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Constraint validation gives an unexpected runtime error #3817

Closed
TharmiganK opened this issue Dec 12, 2022 · 1 comment · Fixed by ballerina-platform/module-ballerina-constraint#42
Assignees
Labels
module/constraint Points/1 Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Milestone

Comments

@TharmiganK
Copy link
Contributor

TharmiganK commented Dec 12, 2022

Description:

When running constraint:validate function with the type/record which has custom annotations other than constraint, the following error is returned :

error: Unexpected error found due to typedesc and value mismatch.

Steps to reproduce:

Run the following code :

import ballerina/constraint;

type ColumnRecord record {|
    string name;
|};

annotation ColumnRecord Column on field;

type Order record {|
    string id;
    @Column {name: "product_id"}
    string productId;
    int quantity;
|};

public function main() returns error? {
    Order req = {
        id: "10",
        productId: "23",
        quantity: 5
    }; 
    req = check constraint:validate(req);
}

Affected Versions:

Ballerina SwanLake 2201.3.0

@github-actions
Copy link

github-actions bot commented Jan 3, 2023

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@TharmiganK TharmiganK added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Jan 5, 2023
@TharmiganK TharmiganK added this to the 2201.4.0 milestone Feb 2, 2023
@TharmiganK TharmiganK modified the milestones: 2201.4.0, 2201.3.3 Feb 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
module/constraint Points/1 Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant