Skip to content

The proper user code #310

@OnkelTem

Description

@OnkelTem

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions