Skip to content
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

Fix to make tonweb compatible with Python module "ton-http-api" #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Stanislav-Povolotsky
Copy link

According to the TonRequestJsonRPC scheme, the "id" field must have 'string' type.

If the "id" field is a number, the Python ton-http-api module returns the following error:
"error": "Validation error: [{'type': 'string_type', 'loc': ('body', 'id'), 'msg': 'Input should be a valid string'

The TonCenter endpoint (https://toncenter.com/api/v2/jsonRPC) works well because the "id" value is converted to a string somewhere on its way to the server. It also has string type in the response.

TonRequestJsonRPC scheme from https://toncenter.com/api/v2/openapi.json

"TonRequestJsonRPC": {
    "title": "TonRequestJsonRPC",
    "required": [
        "method"
    ],
    "type": "object",
    "properties": {
        "method": {
            "title": "Method",
            "type": "string"
        },
        "params": {
            "title": "Params",
            "type": "object",
            "default": {}
        },
        "id": {
            "title": "Id",
            "type": "string"
        },
        "jsonrpc": {
            "title": "Jsonrpc",
            "type": "string"
        }
    }
}

According to the TonRequestJsonRPC scheme, the "id" field must have 'string' type.

If the "id" field is a number, the Python ton-http-api module returns the following error:
"error": "Validation error: [{'type': 'string_type', 'loc': ('body', 'id'), 'msg': 'Input should be a valid string'

The TonCenter endpoint (https://toncenter.com/api/v2/jsonRPC) works well because the "id" value is converted to a string somewhere on its way to the server. It also has string type in the response.

TonRequestJsonRPC scheme from https://toncenter.com/api/v2/openapi.json
"TonRequestJsonRPC": {
    "title": "TonRequestJsonRPC",
    "required": [
        "method"
    ],
    "type": "object",
    "properties": {
        "method": {
            "title": "Method",
            "type": "string"
        },
        "params": {
            "title": "Params",
            "type": "object",
            "default": {}
        },
        "id": {
            "title": "Id",
            "type": "string"
        },
        "jsonrpc": {
            "title": "Jsonrpc",
            "type": "string"
        }
    }
}
@TheSmartnik
Copy link

Thanks! Had the same problem. The fix is working

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

Successfully merging this pull request may close these issues.

3 participants