svix / svix-webhooks

The enterprise-ready webhooks service 🦀
https://www.svix.com
MIT License
2.32k stars 159 forks source link

JavaScript/TypeScript SDK type issues #1451

Open mderriey opened 3 days ago

mderriey commented 3 days ago

Originally posted on Slack at https://svixcommunity.slack.com/archives/C022BJ2EBHV/p1727206631611579

Bug Report

Version

svix npm package v1.34.0.

Platform

N/A

Description

We're using the svix npm package to interact with the API and we found a case where the TypeScript types are incorrect.

The Svix.endpoint.patch function takes an EndpointPatch argument typed as follows:

export class EndpointPatch {
  // Most properties omitted for brevity
  'channels'?: Array<string>;
  'filterTypes'?: Array<string>;
}

These two properties do not allow null, although the API does accept null values for these properties as per https://api.svix.com/docs#tag/Endpoint/operation/v1.endpoint.patch, meaning we've had to use an as type assertion to avoid a TypeScript error.

Any chance we can see if openapi-generator can correctly type those? All properties in this type are marked as nullable so I suspect it's an openapi-generator config we may be missing.

Thanks in advance!

tasn commented 2 days ago

Thanks for reporting!