-
Notifications
You must be signed in to change notification settings - Fork 31
Mutation property type error in generated react query file #80
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
Comments
so the client is ok, it's a mismatch between the react-query interface and implementation? @adairrr have you experienced this? I think it could be a relatively simple fix. We may need to duplicate the interface if we're reusing it, and make a snake case version. also, could be a use-case for https://github.com/sindresorhus/type-fest and we may not even need to duplicate the interface if I understand it correctly. |
@pyramation yes, client is ok. The error happens in react-query files. |
@dadamu can you send me the json schemas from which you're generating the code? |
I was able to repro the issue - should be an easy fix. It's interesting to me that the The schema references the type that's used: {
"description": "Mint a new NFT, can only be called by the contract minter",
"type": "object",
"required": [
"mint"
],
"properties": {
"mint": {
"$ref": "#/definitions/MintMsg_for_Nullable_Empty"
}
},
"additionalProperties": false
}, |
At the revoke mutation, it uses the pascal case as well: export interface Test721RevokeMutation {
client: Test721Client;
msg: {
spender: string;
tokenId: string;
};
args?: {...};
} Ah, but there's no ref here. {
"description": "Remove previously granted Approval",
"type": "object",
"required": [
"revoke"
],
"properties": {
"revoke": {
"type": "object",
"required": [
"spender",
"token_id"
],
"properties": {
"spender": {
"type": "string"
},
"token_id": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}, |
@dadamu try this
|
@pyramation Thanks for the help! However, after this changes, non-cw721 schema codegen will be error:
The whole schemas I used are here, both cw721-schemas and schemas. In addition, |
Deps: #33 This PR re enables the react query generation, the previous error fixed by hyperweb-io/ts-codegen#80
The generated react query from cw721-base has the error in
useCw721BaseMintMutation
function from theCw721BaseMintMutation
with wrong type msg property.The
msg
inCw721BaseMintMutation
is using generated msg whose properties are in snake-case, it mismatches the clientmint
function to use the object with camel-case naming:Here is an example:
The structure of msg are snake case naming:
The client mint required args are camel case naming:
The text was updated successfully, but these errors were encountered: