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

The proper user code #310

Open
OnkelTem opened this issue Aug 23, 2022 · 0 comments
Open

The proper user code #310

OnkelTem opened this issue Aug 23, 2022 · 0 comments

Comments

@OnkelTem
Copy link

OnkelTem commented Aug 23, 2022

Hi everybody.

It seems like I'm missing the proper way to write an app for the code, generated by this plugin.

Imagine a message with like 30 fields. So it's gonna be a class with 60 methods now, and it doesn't look like there are some shortcuts. I only found the <MessageType>.AsObject type and toObject() utility which come in handy when you work with results.

However, to create a message, I write a code like:

const req = new Message1();
if (field1 != null) {
  req.setField1(field1);
}
if (field2 != null) {
  req.setField2(field2);
}
// ...
if (fieldN != null) {
  req.setFieldN(fieldN);
}

`- i.e. self-repeating, not nice, hard to maintain etc. For example, with OpenAPI I wouldn't need just any of that.
I would gladly write a few wrappers, but it doesn't seem to be possible as well, because there are no prop lists to iterate over.

So how do you folks do it? Or are you really typing all this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant