kiota: TypeScript bug - Create message request returns bad request error
Testing code:
const userRequestBuilder = client.usersById("ID");
const messagesRequestBuilder = userRequestBuilder.messages;
const message = new Message();
message.subject = "test subject";
const post = await messagesRequestBuilder.post(message);
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (28 by maintainers)
Creating a separate issue #1013 to discuss more about interfaces vs classes as this discussion is not related to this present issue.
+1 to what @sebastienlevert said.
new Message()doesn’t seem like anything I’ve ever seen in JavaScript. It’s intuitive in C#, but not in JavaScript. Rather than imposing a specific usage patterns on developers, we should see if there are other ways for us to implement necessary plumbing while allowing developers to use programming patterns they’re used to.Definitely, this would add a lot of value here. But, why are we using classes vs Interfaces? Interfaces would allow us to achieve this. There is probably a reason behind this design, so if we can do the partial initializers, this would be a great start. But let’s think in a “JavaScript / TypeScript” way and not in a non-familiar way for developers. If they never used
new EmailAddress()in the past, I don’t know if they should in the future, as long as they respect the interface…Actually, just after writing this, I remember we could do that in TypeScript, maybe this is something we should consider adding to enable the (shorter) second style https://stackoverflow.com/a/37682352/3808675
Am I reading this correctly, that developers using the SDK, will be able to call:
without having to wrap the
messagein ArrayBuffer first?Just to ensure that we’re talking about the same: using ArrayBuffer is not the problem in itself, as long as we don’t require developers to wrap all payloads in it. If we use ArrayBuffer, or anything else internally, that’s our design decision.