aliyun / alibabacloud-go-sdk

https://next.api.aliyun.com/
31 stars 8 forks source link

DTS 20200101 调用DescribePreCheckStatusResponse接口报错 #61

Closed raojinlin closed 5 months ago

raojinlin commented 1 year ago

调用DescribePreCheckStatusResponse接口报错。API调用是没问题,但是将响应数据反序列化成DescribePreCheckStatusResponse结构体时报错:

client.DescribePreCheckStatusResponse.Body: client.DescribePreCheckStatusResponseBody.Total: readUint32: unexpected character: �, error found in #0 byte of ...||..., bigger context ...||...

复现代码:

package main

import (
    "encoding/json"
    "fmt"

    dts20200101 "github.com/alibabacloud-go/dts-20200101/v2/client"
    "github.com/alibabacloud-go/tea/tea"
)

func main() {
    var resp dts20200101.DescribePreCheckStatusResponse
    body := []byte(`{"body":{"AnalysisJobProgress":[],"Code":"03","ErrorItem":0,"FullNetCheckJobStatus":[],"HttpStatusCode":200,"JobId":"","JobName":"dts.step.data.load","JobProgress":[{"BootTime":"","CanSkip":false,"Current":"2515385","DelaySeconds":0,"DestSchema":"mydb","FinishTime":"2023-08-14T07:21:58.000+00:00","Id":"55551531398730277","IgnoreFlag":"N","Item":"mydb.table_105","JobId":"ga0x8qys14hf4p5","Logs":[],"Names":"table_105","Skip":false,"SourceSchema":"mydb","State":"Success","Sub":[],"TargetNames":"table_105_dts","Total":"3346062"}],"PageNumber":1,"PageRecordCount":20,"RequestId":"CB1ACDDF-6688-327B-BBE5-C26378A0FF26","State":"Finished","SubDistributedJobStatus":[],"Success":true,"Total":1,"TotalRecordCount":1},"headers":{"access-control-allow-origin":"*","access-control-expose-headers":"*","connection":"keep-alive","content-length":"741","content-type":"application/json;charset=utf-8","date":"Mon, 14 Aug 2023 08:56:55 GMT","etag":"7ffOLDs6u3BEkWXt92cH9Lg1","keep-alive":"timeout=25","x-acs-request-id":"CB1ACDDF-6688-327B-BBE5-C26378A0FF26","x-acs-trace-id":"4bafa1c23271affec374883e2ea1279d"},"statusCode":200}`)

    var bodyMap map[string]interface{}
    json.Unmarshal(body, &bodyMap)
    err := tea.Convert(bodyMap, &resp)
    fmt.Printf("%v", err.Error())
}
TsinghuaDream commented 5 months ago

这块是API维护者结构配置错误,但是改动的话是不兼容变更,解决方案可以是使用门户生成的commonrequest示例可避开该问题。https://api.aliyun.com/api/Dts/2020-01-01/DescribePreCheckStatus?params={%22RegionId%22:%22cn-shanghai%22,%22DtsJobId%22:%22123%22,%22JobCode%22:%22123%22,%22StructType%22:%22123%22}&tab=DEMO&lang=GO&useCommon=true image