Skip to content

Add Custom Validate Constraints to StartModuleRequest#41

Description

@thibaud-perrin

馃摚 Add Custom Validate Constraints to StartModuleRequest

馃摑 Issue Description

In the proto file digitalkin/module/v1/lifecycle.proto, within the StartModuleRequest message, we need to add custom validate constraints as described in Buf's custom constraints documentation. This is to ensure the content is validated based on the request_type, which will help prevent errors and assist the user in understanding what went wrong. Below is an example of a custom constraint:

message Event {
  int64 start_time = 1;
  int64 end_time = 2;
  option (buf.validate.message).cel = {
    id: "event.start_time_before_end_time",
    message: "Start time must be before end time",
    expression: "this.start_time < this.end_time",
  };
}

馃殌 Objective

To implement custom validation constraints in the StartModuleRequest message to ensure the content is appropriately validated based on the request_type.

馃悶 Problem Reproduction

  1. Open the proto file digitalkin/module/v1/lifecycle.proto.
  2. Locate the StartModuleRequest message.
  3. Observe the lack of custom validation constraints on the content field.
  4. Note that without these constraints, users may encounter errors without clear guidance.

馃挵 Business Outcome

Implementing this task will reduce user errors and improve the user experience by providing clearer validation messages, potentially reducing support requests and increasing user satisfaction.

馃摑 Task List

  • Review the StartModuleRequest message in digitalkin/module/v1/lifecycle.proto.
  • Implement custom validation constraints for the content field based on request_type.
  • Test the new constraints to ensure they work as expected.
  • Update documentation if necessary.

馃挕 Potential Solution

Refer to the example provided and the Buf custom constraints documentation to implement the necessary validation logic.

馃搱 Priority

Low 馃挙

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions