Skip to content
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 our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating a sample breaks when regex used on identifier #629

Closed
DianaLease opened this issue Mar 23, 2023 · 0 comments 路 Fixed by #630
Closed

Generating a sample breaks when regex used on identifier #629

DianaLease opened this issue Mar 23, 2023 · 0 comments 路 Fixed by #630
Assignees

Comments

@DianaLease
Copy link
Member

Bug Report 馃悰

The code used to generate a sample generates a string ("resource1") for the identifying field without taking into account any regex validation on that property

Expected Behavior

The code used to generate the sample should check if the identifying field has regex and generate a value that conforms to that regex.

Current Behavior

The code used to generate the sample doesn't conform to that regex.

Possible Solution

This code should take into account any regex on the identifying property.

Steps to Reproduce

Create a concept that is identified by a property that has regex on it like so:

concept Person identified by ssn {
 o String name
 @description("Height (cm)")
 o Double height range=[0.0,]
 o DateTime dateOfBirth
 o String ssn regex=/\d{3}-\d{2}-\d{4}/
}

Run concerto generate sample for that concept. See error.

ERROR: Validator error for field `test@1.0.0.Person#resource1`. test@1.0.0.Person.ssn: Value 'resource1' failed to match validation regex: /\d{3}-\d{2}-\d{4}/

Context (Environment)

Desktop

  • OS: [e.g. macOS]
  • Browser: [e.g. Chrome, Safari]
  • Version: [e.g. 0.22.15]

Detailed Description

Possible Implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant