line / line-bot-sdk-go

LINE Messaging API SDK for Go
https://developers.line.biz/en/docs/messaging-api/overview/
Apache License 2.0
893 stars 236 forks source link

The encoding of the `spacer` element looks incorrect. #467

Closed kyu-suke closed 4 months ago

kyu-suke commented 4 months ago

The encoding of the spacer type in the flex message object appears to be incorrect. It seems necessary to add a model definition (such as in linebot/messaging_api/model_flex_spacer.go) and unmarshal logic in linebot/messaging_api/model_flex_component.go. If this approach is acceptable, I would like to proceed with submitting a pull request. Please let me know if there are any concerns or suggestions for improvement. Note: According to the FLEX MESSAGE SIMULATOR, "Spacer is no longer supported and will be removed in a future version." Are you planning to add definitions for spacer?

System Informations

Expected Behavior

{
    "type": "flex",
    "altText": "",
    "contents": {
        "type": "bubble",
        "body": {
            "layout": "vertical",
            "flex": 0,
            "type": "box",
            "contents": [
                {
                    "type": "spacer",
                    "size": "xl"
                }
            ]
        }
    }
}

Current Behavior

{
    "type": "flex",
    "altText": "",
    "contents": {
        "type": "bubble",
        "body": {
            "layout": "vertical",
            "flex": 0,
            "type": "box",
            "contents": [
                {
                    "FlexComponentInterface": null,
                    "Type": "spacer",
                    "Raw": {
                        "size": "xl",
                        "type": "spacer"
                    }
                }
            ]
        }
    }
}

Steps to Reproduce

flex := `{
    "type": "flex",
    "contents": {
        "type": "bubble",
        "body": {
            "type": "box",
            "layout": "vertical",
            "contents": [
                {
                    "type": "spacer",
                    "size": "xl"
                }
            ]
        }
    }
}`
f, _ := messaging_api.UnmarshalMessage([]byte(flex))
ff, _ := json.MarshalIndent(f, "", "    ")
fmt.Println(string(ff))
habara-k commented 4 months ago

Thank you for using the line-bot-sdk.

As stated, "Spacer is no longer supported and will be removed in a future version," there are no plans to support it in the SDK in the future either.