stripe-go icon indicating copy to clipboard operation
stripe-go copied to clipboard

make optional event attributes optional

Open m-mattia-m opened this issue 1 year ago • 3 comments

When my API receives a webhook request from Stripe via the CLI, I get the error expected required property account to be present and the location attribute is: body. After creating a manual request with the same body and adding the 'account' attribute (which is an empty string), I got the same error for the 'previous_attributes' attribute in the 'body.data' location. After adding that element as well, it worked.

I checked the stripe docs, I saw that the account' attribute is a nullable string'. The previous_attributes is a nullable map. However, the stripe-go-sdk considers these attributes to be required attributes.

Stripe Docs - The Event object

m-mattia-m avatar Oct 13 '24 14:10 m-mattia-m

CLA assistant check
All committers have signed the CLA.

cla-assistant[bot] avatar Oct 13 '24 14:10 cla-assistant[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

cla-assistant[bot] avatar Oct 13 '24 14:10 cla-assistant[bot]

Hi @m-mattia-m! Thanks for opening this PR! The events.go file is actually generated from our API specification, so we'll need to look at what may be causing these fields to not be marked correctly as optional. Would you mind also opening a GH issue that describes the issue? If you can include an example snippet of code and commands to run to show the error, that would be awesome. We can do some investigation internally, and then collaborate on the fix on this PR.

jar-stripe avatar Oct 17 '24 16:10 jar-stripe

This is being tracked in https://github.com/stripe/stripe-go/issues/1937, so closing out this PR.

mbroshi-stripe avatar Apr 15 '25 15:04 mbroshi-stripe