-
Notifications
You must be signed in to change notification settings - Fork 349
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: add options to limit generating encode and decode methods to only specific message types #1084
Comments
Hi @akrennmair ; thanks for the PR! I guess that makes sense... Out of curiosity, for your use case, is each type only primitives? Or does it have other messages? I.e. I could see something like:
Such that to "encode Person", you actually end up ending |
@stephenh the way we structure our messages is through nested message types, so we do have more complex structures in there, but they're all underneath our request message type, so they'd be automatically covered by a regex just matching for a prefix. I updated one of the integration tests to specifically demonstrate that: https://github.com/stephenh/ts-proto/pull/1085/files#diff-1039be2c30dc2bd6576bdf8e7acd59bee9e3bf408cf023373f9bf2241d675a69 I have been thinking as well whether it could become too tedious to manually manage the regular expression, so I wonder whether it would also makes sense to add inverted options, i.e. |
Hi @stefan-koshiw , thanks for the ping; #1085 does lgtm. For some reason I don't see the "Approve & Run" button that I usually click for PRs to have the GitHub actions run -- @akrennmair can you try rebasing/updating your PR, and see if that fixes things? Once I can get the CI build passing, it lgtm and we can merge it. Thanks! |
Fixed in #1085 , thanks @akrennmair ! |
I'm facing the specific problem that a significant amount of the generated script size of a project mine consists of scripts generated by ts-proto. I was looking into limiting what is being generated, and found the
outputEncodeMethods
option to be too limited: generally speaking, I have two top-level types, and for one (the request type) I only want to generate anencode
method, while for the other (the response type), I only want to generate adecode
method.I would therefore like to have options to limit the generation of
encode
resp.decode
methods to only specific types. A similar suggestion has also been made as a comment to #773: #773 (comment)I also have a branch in which I implemented a possible solution that simply regular expressions. I'm not sure though whether this is sufficient as a general solution. I will submit a PR for it.
The text was updated successfully, but these errors were encountered: