-
Notifications
You must be signed in to change notification settings - Fork 32
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
Story- 711 new data structure regulation validation #721
Conversation
rosetta-lang/src/main/java/com/regnosys/rosetta/generator/java/object/ValidatorsGenerator.xtend
Outdated
Show resolved
Hide resolved
rosetta-lang/src/main/java/com/regnosys/rosetta/generator/RosettaGenerator.xtend
Outdated
Show resolved
Hide resolved
...ta-lang/src/main/java/com/regnosys/rosetta/generator/java/validator/ValidatorGenerator.xtend
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ChoiceRuleValidationMethod.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ModelValidationResult.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ModelValidationResult.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/NumberValidationData.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/StringValidationData.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ValidationData.java
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ValidationResult.java
Outdated
Show resolved
Hide resolved
rosetta-runtime/src/main/java/com/rosetta/model/lib/validation/ValidationResult.java
Outdated
Show resolved
Hide resolved
|
||
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) { |
There was a problem hiding this comment.
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 genericT
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>() { |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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» ; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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. :)
close replaced with #722 |
new Data structure to hold Validation results for Regulation Diagnostic panel
Type of change
Please delete options that are not relevant.