CosmWasm / ts-codegen

Convert your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
https://cosmology.zone/products/ts-codegen
Apache License 2.0
116 stars 29 forks source link

optional tuples breaks codegen #65

Closed pyramation closed 2 years ago

pyramation commented 2 years ago

schema https://gist.github.com/pyramation/f6c5cb37a13ed461fd7cbbcf7b13422b

culprit:

              "start_after": {
                "type": [
                  "array",
                  "null"
                ],
                "items": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string"
                  }
                ],
                "maxItems": 2,
                "minItems": 2
              }
pyramation commented 2 years ago

should be fixed with #66

grod220 commented 2 years ago

Sadly, the error seems to persist after the version bump: https://github.com/grod220/ts-codegen-example

pyramation commented 2 years ago

I left one case out — please try now! thanks @grod220

Successfully published:
 - @cosmwasm/ts-codegen@0.16.1
grod220 commented 2 years ago

Sorry, but think I found a follow up issue with the types is generates for this. It generates something like:

import { ArrayOf_SharesResponseItem } from "./AccountNft.types";

export interface AccountNftReadOnlyInterface {
  allDebtShares: () => Promise<ArrayOfSharesResponseItem>;
}

This does not compile because the import has an underscore _ in the name and the type does not.