SpineEventEngine / validation

Apache License 2.0
2 stars 0 forks source link

Make generated messages implement `ValidatableMessage` #54

Closed alexander-yevsyukov closed 1 year ago

alexander-yevsyukov commented 1 year ago

This PR teaches Validation to make generated code of message types to implement ValidatableMessage interface.

This interface used to be named MessageWithConstraints and had validate() method which returned a list of ValidationConstraint. Now it returns Optional<ValidationError> as in the recently generated code.

Other notable changes:

codecov[bot] commented 1 year ago

Codecov Report

Merging #54 (233cddb) into master (6edc575) will decrease coverage by 1.13%. The diff coverage is 2.43%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #54 +/- ## ============================================ - Coverage 45.03% 43.89% -1.14% - Complexity 450 451 +1 ============================================ Files 117 122 +5 Lines 2578 2654 +76 Branches 210 211 +1 ============================================ + Hits 1161 1165 +4 - Misses 1370 1443 +73 + Partials 47 46 -1 ```
alexander-yevsyukov commented 1 year ago

@armiol, @dmdashenkov,

In relation to the Text type, we probably need even a type with such or similar name introduced at the level of ProtoData or even as a separate small library under the package io.spine.text.

We definitely have a generic subdomain which deals with text blocks, lines of text, etc. Passing ImmutableList<String> was OK for the start, but 1) it's too many characters to read, and 2) let's not limit ourselves to generating the code only in Java.

We may also benefit from having protobuf-based type Text in other projects.

Let's discuss this when time permits.