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

JavaScript/TypeScript SDK type issues #1451

Closed
mderriey opened this issue Sep 25, 2024 · 3 comments
Closed

JavaScript/TypeScript SDK type issues #1451

mderriey opened this issue Sep 25, 2024 · 3 comments
Assignees
Labels
lib/javascript JavaScript client library

Comments

@mderriey
Copy link

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 tasn added lib/javascript JavaScript client library grooming labels Sep 26, 2024
@tasn
Copy link
Member

tasn commented Sep 26, 2024

Thanks for reporting!

@tasn
Copy link
Member

tasn commented Oct 23, 2024

I think it may be fixed by #1480

@svix-onelson svix-onelson self-assigned this Oct 28, 2024
@svix-onelson
Copy link
Contributor

I think it may be fixed by #1480

Looks like it should be, yes.

The new generator produces the following:

export class EndpointPatch {
    'channels'?: Array<string> | null;
    'filterTypes'?: Array<string> | null;

The updated models should be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib/javascript JavaScript client library
Projects
None yet
Development

No branches or pull requests

3 participants