algorand / generator

OpenAPI parser/generator.
9 stars 13 forks source link

JS v3: Native bigint support for select fields #72

Closed jasonpaulos closed 7 months ago

jasonpaulos commented 8 months ago

Currently JS types every numeric field as number | bigint. This isn't very useful, since you can't operate directly against this union type.

This PR allows the generated types to use either number or bigint, depending mostly on the x-algorand-format: uint64 tag on fields. Previously this tag was only used to decided whether the Java SDK should use Long or BigInteger for a field.

However, there are two reasons why that approach can only go so far:

To address these issues, I added the ability to manually override types by adding to one of the property files.

For consistency, I made the following quantities always have type bigint, even if they weren't declared with x-algorand-format: uint64 in the REST spec:

These changes are present in this JS SDK PR: https://github.com/algorand/js-algorand-sdk/pull/852