wire code gen extensions
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.4k
- Forks
- 627
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 20
Description
I'm not really sure how to name issue - more of a general question. I can open something more specific if this leads anywhere. I didn't see any similar issue, sorry if I missed something.
There's a specific use case I'm trying to satisfy and a potentially more general way of accomplishing that solution that would fit other needs. I don't think I'm trying to propose something as general as the protoc plugin model.
Very concretely, I'm curious about trying to leverage validation annotations like the ones in https://github.com/envoyproxy/protoc-gen-validate but rather than generate a Validator#validate(Message m) for each message type, I'd like to have the generated object apply its own validations and throw an exception when trying to create an invalid instance. eg. adding require checks to a kotlin init block or very similar to how Immutables Java does precondition checks https://immutables.github.io/immutable.html#precondition-check-method
This same mechanism could possibly extend to supporting field annotations like redacted to exclude the field from toString generation?
Maybe doing domain modeling like this in protos is just a foolish idea?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files, tests, or entry points. Start by clarifying whether the goal is validation during generated-object construction, annotation-driven output changes such as redacted toString methods, or both; done requires an agreed scope and design before implementation can be located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100