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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Story- 711 new data structure regulation validation #721

Closed

Conversation

PayalKhanna
Copy link
Contributor

new Data structure to hold Validation results for Regulation Diagnostic panel

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

@PayalKhanna PayalKhanna changed the title Story/711/new data structure regulation validation Story- 711 new data structure regulation validation Jan 19, 2024

static <T> ValidationResult<T> success(String name, ValidationType validationType, String modelObjectName, RosettaPath path, String definition) {
return new ModelValidationResult<>(name, validationType, modelObjectName, path, definition, Optional.empty());
public static ValidationResult success(RosettaPath path) {
Copy link
Contributor

@SimonCockx SimonCockx Jan 22, 2024

Choose a reason for hiding this comment

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

I have been thinking a bit about backwards compatibility.. I fear that this class is gonna cause problems.

Old workspaces will still contain generated code of the form

ValidationResult<Foo> result = ValidationResult.success("foo", ValidationType.CARDINALITY, "Foo", path, "definition");

which will suddenly stop working because of multiple reasons:

  • The type parameter <Foo> is now invalid, since we got rid of the generic T type.
  • The method ValidationResult.success(String, ValidationType, String, RosettaPath, String) does not exist anymore.
  • The type ValidationResult.ValidationType does not exist anymore.

I'm not sure yet about what our best course of action is.

@@ -234,14 +231,14 @@ public Validator<? super Key> validator() {
return new Validator<Key>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should deprecate this one too, and rather create a KeyValidator implements RosettaModelObjectValidator<Key> using our new infrastructure.

Optional.ofNullable(operator),
result.isSuccess(),
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: think about these changes

Copy link
Contributor

Choose a reason for hiding this comment

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

TODO:

  • add tests that use the compiled code.
  • add tests for inheritance (e.g., type Foo extends Bar)

'''
public class «data.name»Validator implements «RosettaModelObjectValidator»<«modelPojo»>{
«FOR con : data.conditions»
@«Inject» protected «new GeneratedJavaClass(root.condition, con.conditionName(data).toConditionJavaType, Object)» «con.conditionName(data).toFirstLower» ;
Copy link
Contributor

@SimonCockx SimonCockx Jan 22, 2024

Choose a reason for hiding this comment

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

Let's clean up this line together. new GeneratedJavaClass(root.condition, con.conditionName(data).toConditionJavaType, Object) should be a utility method inside JavaTypeTranslator.

Copy link
Contributor

Choose a reason for hiding this comment

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

About the name «con.conditionName(data).toFirstLower» - this may fail to generate valid Java code in certain edge cases, which I haven't explained to you yet. Remind me to explain usage of the JavaScope class to you. :)

@PayalKhanna
Copy link
Contributor Author

close replaced with #722

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 this pull request may close these issues.

2 participants