gocardless-nodejs icon indicating copy to clipboard operation
gocardless-nodejs copied to clipboard

What is the rational for making every field optional

Open aharin opened this issue 3 years ago • 3 comments

Since release 3.0.0 all fields on Payment became optional. What is the rational for this? How are these types should now be used? Should we be using not-null assertion?

According to the api reference fields like amount cannot be undefined. Also it is very strange now that some fields can be both undefined and null.

aharin avatar Nov 22 '22 13:11 aharin

Hi @aharin! Our types are generated from our schema, which marks certain fields as required.

Before v3.0, all fields were wrongfully marked as required and 3.0 switched to defaulting to optional and only marking fields required only if specified by the schema.

We'll have a look to see why some fields are not explicitly required while in practice they are.

Nimisoere avatar Feb 23 '23 17:02 Nimisoere

Hey @Nimisoere , thanks for looking into this. Has there been progress on this by any chance?

matshadow avatar Mar 17 '23 17:03 matshadow

I asked the same question a while back: https://github.com/gocardless/gocardless-nodejs/issues/123

Really sad to see there wasn't any progress on this

sambegin avatar Oct 17 '23 14:10 sambegin