public-awesome / cw-nfts

Examples and helpers to build NFT contracts on CosmWasm
Apache License 2.0
188 stars 180 forks source link

query_msg_for__empty.json: Weird file name and value in title #130

Closed taitruong closed 1 year ago

taitruong commented 1 year ago

This problem doesn't exist in v0.17.0 anymore, since there is now only one schema file for cw721-base. Though it is worth checking why cargo schema creates this file, with title QueryMsg_for_Empty in line 3: query_msg_for__empty:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "QueryMsg_for_Empty",
  "oneOf": [
    {
      "description": "Return the owner of the given token, error if token does not exist Return type: OwnerOfResponse",
...

This causes ts-codegen not being able to create ReadOnlyClientInterface (since it doesn't find QueryMsg). Check issue here: https://github.com/CosmWasm/ts-codegen/issues/120

JakeHartnell commented 1 year ago

The reason it creates this file is that QueryMsg implements generics, i.e. QueryMsg<QueryExtension>, in cw721-base there is no query extension so the value is QueryMsg<Empty> which leads to query_msg_for__empty.json. Make sense?