Skip to content

support for definition in queryMsg / execMsg in schemas #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
whalelephant opened this issue Mar 12, 2023 · 2 comments
Closed

support for definition in queryMsg / execMsg in schemas #98

whalelephant opened this issue Mar 12, 2023 · 2 comments

Comments

@whalelephant
Copy link

When generating schemas from sylvia framework written contracts, the queryMsg (and execMsg) is a ref to a definition, this causes error in ts-codegen.

/Users/.../node_modules/wasm-ast-types/main/client/client.js:175
  var methods = (0, _utils.getMessageProperties)(queryMsg).map(function (jsonschema) {
                                                           ^

Example of the schema

"query": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "QueryMsg",
    "anyOf": [
      {
        "$ref": "#/definitions/InstallableQueryMsg"
      },
      {
        "$ref": "#/definitions/QueryMsg"
      }
    ],
    "definitions": {
      "InstallableQueryMsg": {
        "type": "string",
        "enum": []
      },
      "QueryMsg": {
        "oneOf": [
          { ...}

full version: https://gist.github.com/whalelephant/957540ad83f8a35c05cd08fa7a009385#file-schema-json-L281

@adairrr
Copy link
Contributor

adairrr commented Mar 27, 2023

@pyramation I believe that this is an issue with parsing the entry-point messages here:

https://github.com/CosmWasm/ts-codegen/blob/10c8be3191cc16e89df92030662227e267c2df34/packages/ts-codegen/src/utils/schemas.ts#L73-L102

We should be collapsing the schema first to find them.

@pyramation
Copy link
Collaborator

should be fixed!

Successfully published:
 - @cosmwasm/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants