getlago / lago-javascript-client

Lago Javascript Client
MIT License
21 stars 2 forks source link

[BUG]: Type mismatch in Send usage event's event.properties. Should expect Record<string, number>; NOT Record<string, string>; #43

Closed amiranvarov closed 2 months ago

amiranvarov commented 3 months ago

Describe the bug hey again, came across another mismatch :) Don't hate me, just trying to put my few cents to improve your awesome product.

Docs indicate that event.properties should be an object with key string and value number:

image

But JS Client is expecting customProperty to be string, instead of number. I don't think that string should be expected, as we are here expecting a number event. I doubt that we will report usage of "0.01" or similar. Anyways: here is the screenshot of typing mismatch in JS client (even in the comments it's indicated that number is expected, but typescript still expects string):

image image image

Even in the JS Tab of docs, there is a mismatch:

image

PS: Maybe it's the issue with the generator you are using. You may try to switch to paid options like https://www.speakeasyapi.dev or https://liblab.com/ maybe? I DO NOT have any affiliates with them. I was considering to integrate their service into my product, so it would be interesting for me to watch how your experience is going to be by using their services. That's why I'm recommending to try them. They also have a free option for SDK for one language. Anyways, it was just my thought.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Support

Additional context Add any other context about the problem here.

vincent-pochet commented 2 months ago

Thank you very much @amiranvarov for opening this issue.

Indeed, the OpenAPI definition is incomplete. Event payload could contains values with distinct types. I've updated the definition and a new version of the SDK will be release soon