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

[Feature Request] Swift Support #71

Open
elliotmjackson opened this issue Aug 10, 2023 · 0 comments
Open

[Feature Request] Swift Support #71

elliotmjackson opened this issue Aug 10, 2023 · 0 comments
Labels
Feature New feature or request Language Support Interest in adding support for another language

Comments

@elliotmjackson
Copy link
Contributor

elliotmjackson commented Aug 10, 2023

Feature description:
Extend the capabilities of the protovalidate library to include support for performing runtime validation of Protocol Buffers messages in Swift projects.

Problem it solves or use case:
The current lack of Swift support in the protovalidate library poses challenges for developers who work with Protocol Buffers and Swift. By introducing Swift support, developers can validate Protocol Buffers messages at runtime within their Swift applications, enhancing data integrity and reducing potential issues related to data validation.

Proposed implementation or solution:
The proposed solution involves extending the existing protovalidate library to incorporate Swift bindings and compatibility. This includes defining Swift structures or classes that mirror Protocol Buffers message structures, and implementing runtime validation functions that align with Swift's strong typing.

Challenges with Enforcing Validation on the Swift Client:
Enforcing validation on the Swift client could introduce challenges due to the widespread impact of validation changes. Swift's strong typing and compile-time safety would necessitate strict adherence to validation rules. However, making validation changes would lead to breaking changes on both the client and server sides. Any update to validation rules could result in inconsistencies between the client and server if they're not synced properly. This would require maintaining compatibility across different versions of the Protocol Buffers definitions, which could become a complex and error-prone task.

Importance of a CEL Interpreter for Advanced Validation:
To address these challenges, an integral part of the solution would involve creating a CEL (Common Expression Language) interpreter for Swift. CEL allows for the specification of complex validation rules in an expressive and language-agnostic manner. This interpreter would be instrumental in enabling advanced validation expressions that can be used within the protovalidate library. Given that a CEL interpreter for Swift is not currently under development an effort would need to be undertaken to create this

Contribution:
I am enthusiastic about contributing to this feature by participating in discussions, assisting in defining Swift type structures, collaborating on the implementation of runtime validation functions for Swift, and potentially contributing to the development of the CEL interpreter for Swift. I am also willing to help with writing tests and documentation to ensure comprehensive coverage and guidance.

Examples or references:
While protovalidate does not currently offer Swift support, libraries like connect-swift, SwiftProtobuf and gRPC-Swift can provide insights into integrating Protocol Buffers messages into Swift projects.

Additional context:
Adding Swift support to the protovalidate library will cater to developers who use Protocol Buffers in Swift applications, allowing them to perform runtime validation without the need for external code generation. The creation of a CEL interpreter for Swift would further enhance the validation capabilities of the library, enabling advanced validation expressions to be used seamlessly across languages.

@elliotmjackson elliotmjackson added the Feature New feature or request label Aug 10, 2023
@elliotmjackson elliotmjackson added the Language Support Interest in adding support for another language label Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Language Support Interest in adding support for another language
Projects
None yet
Development

No branches or pull requests

1 participant