You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature description:
Extend the functionality of the protovalidate library to include support for defining and enforcing validation rules on methods within Protocol Buffers service definitions.
Problem it solves or use case:
Currently, the protovalidate library focuses on validating individual message fields, but lacks the ability to validate the parameters and return values of methods defined within Protocol Buffers services. By introducing validation rules on methods, developers can ensure that the inputs and outputs of service methods adhere to specified constraints, enhancing data integrity and API consistency.
Proposed implementation or solution:
The proposed solution involves enhancing the protovalidate library to support validation rules specific to service methods. This includes introducing annotations or configuration options that allow developers to specify validation rules for method parameters and return values within Protocol Buffers service definitions. The library would then enforce these rules during runtime method calls.
Benefits of Method-Level Validation:
Method-level validation provides several benefits, including enhanced data validation, improved API documentation by making validation expectations explicit, and reduced likelihood of malformed data causing errors downstream. This feature also aligns with best practices for ensuring data integrity and robustness in service-oriented architectures.
Examples or references:
Other API frameworks, like gRPC, often include features for specifying validation rules on method parameters and responses. These can serve as references for how such functionality can be integrated into the protovalidate library.
Additional context:
The inclusion of validation rules on methods within the protovalidate library will significantly enhance the data validation capabilities of Protocol Buffers services. Developers will be able to define and enforce constraints on the inputs and outputs of methods, leading to more reliable and robust service interactions. This feature aligns with the evolving demands of API design and data integrity.
The text was updated successfully, but these errors were encountered:
I'm not sure if this fits under this issue or if it's something separate, but I'm interested in having separate validation for multiple methods using the same proto message. We generally follow Google's AIP recommendations, and for Create/Update calls, they specifically use the same message in both request objects. That generally works great, but often validation for create has different constraints than for an update. To solve this, it seems like it can be approached in a few ways:
Per this issue, have separate validation rules on the method
Add validation rules to the separate request messages
Make the calling method available as a CEL argument
2 seems like the most maintainable, though it would really benefit from shared / reusable rules. Thoughts?
igor-tsiglyar
pushed a commit
to igor-tsiglyar/protovalidate
that referenced
this issue
Apr 16, 2024
Feature description:
Extend the functionality of the
protovalidate
library to include support for defining and enforcing validation rules on methods within Protocol Buffers service definitions.Problem it solves or use case:
Currently, the
protovalidate
library focuses on validating individual message fields, but lacks the ability to validate the parameters and return values of methods defined within Protocol Buffers services. By introducing validation rules on methods, developers can ensure that the inputs and outputs of service methods adhere to specified constraints, enhancing data integrity and API consistency.Proposed implementation or solution:
The proposed solution involves enhancing the
protovalidate
library to support validation rules specific to service methods. This includes introducing annotations or configuration options that allow developers to specify validation rules for method parameters and return values within Protocol Buffers service definitions. The library would then enforce these rules during runtime method calls.Benefits of Method-Level Validation:
Method-level validation provides several benefits, including enhanced data validation, improved API documentation by making validation expectations explicit, and reduced likelihood of malformed data causing errors downstream. This feature also aligns with best practices for ensuring data integrity and robustness in service-oriented architectures.
Examples or references:
Other API frameworks, like gRPC, often include features for specifying validation rules on method parameters and responses. These can serve as references for how such functionality can be integrated into the
protovalidate
library.Additional context:
The inclusion of validation rules on methods within the
protovalidate
library will significantly enhance the data validation capabilities of Protocol Buffers services. Developers will be able to define and enforce constraints on the inputs and outputs of methods, leading to more reliable and robust service interactions. This feature aligns with the evolving demands of API design and data integrity.The text was updated successfully, but these errors were encountered: