Swagger.yml and code-generation

Hey,

in our Java-SDK we generate classes based on the swagger.yml and I am a bit confused why sometimes the integer attributes are declared as int64 and sometimes not.

Especially the attributes of objects related to contracts are not declared as int64. This is a bit confusing because I think at least the fee attribut needs to be a int64.

Would be nice to get some feedback here. If this is a mistake please look through all objects and change that accordingly.

Besides that we added discriminator: tx to the UnsignedTx-object because we want UnsignedTx to be generated as superclass of CreateContractUnsignedTx.

Regards,
Marco

About the int types there were problems also with the go sdk, and in the end we had to preprocess the swagger to use custom types.
This had to be done anyway since int64 (should be Long in java) is not big enough to represent ERC20 tokens (among other things), I think you should anyway use BigInt or something similar.

yes we are already preprocessing the int64 type into BigInteger. but I am wondering why on these oracle-objects some attributes are not even declared as int64 although they should be IMO. that is why in this case still a normal Integer is generated.

I am questioning the consistency of the swagger.yml generally with this question. I can additionally preprocess every integer into BigInteger. but if this is somehow wrong defined I would prefer the swagger.yml to be updated.

I agree with @marco.chain. There is definitely some inconsistency in swagger data types.
Most of the data type for fee is:

      fee:
        type: integer
        format: int64

While ContractCreateTx uses regular integer:

      fee:
        description: Transaction fee
        type: integer
        minimum: 0

Same goes for amount most of the time is int64 but sometimes regular integer.

Hey there people, this was one of the problems I ran into very quickly when developing the Go SDK. I’ve scripted all the changes I make to the swagger.json file here:

edit.py describes what needs to be done.

I’ve also opened an issue for this

but I’m not sure what’s the status.

2 Likes

can someone of the æternity team give a response whether the swagger.yml will be adapted accordingly?

1 Like

I commented on the Issue, swagger isn’t really up for this task…