Giter VIP home page Giter VIP logo

Comments (5)

mpyw avatar mpyw commented on June 11, 2024

The official typing uses anonymous objects, so it doesn't seem to be treated as ObjsMessage. However, composing a items[0] and items[1] whose properties are completely nullable perfectly partially matches for ObjsMessage, so it's OK to go with it. This is a much better solution than mixed.

"messages": {
    "items": {
        "items": [
            {
                "additionalProperties": false,
                "properties": {
                    "last_read": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "latest_reply": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "reply_count": {
                        "type": "integer"
                    },
                    "reply_users": {
                        "items": {
                            "$ref": "#/definitions/defs_user_id"
                        },
                        "type": "array",
                        "uniqueItems": true
                    },
                    "reply_users_count": {
                        "type": "integer"
                    },
                    "source_team": {
                        "$ref": "#/definitions/defs_team"
                    },
                    "subscribed": {
                        "type": "boolean"
                    },
                    "team": {
                        "$ref": "#/definitions/defs_team"
                    },
                    "text": {
                        "type": "string"
                    },
                    "thread_ts": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "ts": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "type": {
                        "type": "string"
                    },
                    "unread_count": {
                        "type": "integer"
                    },
                    "user": {
                        "$ref": "#/definitions/defs_user_id"
                    },
                    "user_profile": {
                        "$ref": "#/definitions/objs_user_profile_short"
                    },
                    "user_team": {
                        "$ref": "#/definitions/defs_team"
                    }
                },
                "required": [
                    "type",
                    "user",
                    "text",
                    "thread_ts",
                    "reply_count",
                    "subscribed",
                    "ts"
                ],
                "type": "object"
            },
            {
                "additionalProperties": false,
                "properties": {
                    "is_starred": {
                        "type": "boolean"
                    },
                    "parent_user_id": {
                        "$ref": "#/definitions/defs_user_id"
                    },
                    "source_team": {
                        "$ref": "#/definitions/defs_team"
                    },
                    "team": {
                        "$ref": "#/definitions/defs_team"
                    },
                    "text": {
                        "type": "string"
                    },
                    "thread_ts": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "ts": {
                        "$ref": "#/definitions/defs_ts"
                    },
                    "type": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/definitions/defs_user_id"
                    },
                    "user_profile": {
                        "$ref": "#/definitions/objs_user_profile_short"
                    },
                    "user_team": {
                        "$ref": "#/definitions/defs_team"
                    }
                },
                "required": [
                    "type",
                    "user",
                    "text",
                    "thread_ts",
                    "parent_user_id",
                    "ts"
                ],
                "type": "object"
            }
        ]
    },
    "type": "array"
}
"objs_message": {
    "additionalProperties": false,
    "properties": {
        "attachments": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "fallback": {
                        "type": "string"
                    },
                    "id": {
                        "type": "integer"
                    },
                    "image_bytes": {
                        "type": "integer"
                    },
                    "image_height": {
                        "type": "integer"
                    },
                    "image_url": {
                        "type": "string"
                    },
                    "image_width": {
                        "type": "integer"
                    }
                },
                "required": [
                    "id"
                ],
                "type": "object"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
        },
        "blocks": {
            "$ref": "#/definitions/blocks"
        },
        "bot_id": {
            "items": [
                {
                    "$ref": "#/definitions/defs_bot_id"
                },
                {
                    "title": "Nil bot_id set when display_as_bot is false",
                    "type": "null"
                }
            ]
        },
        "bot_profile": {
            "$ref": "#/definitions/objs_bot_profile"
        },
        "client_msg_id": {
            "type": "string"
        },
        "comment": {
            "$ref": "#/definitions/objs_comment"
        },
        "display_as_bot": {
            "type": "boolean"
        },
        "file": {
            "$ref": "#/definitions/objs_file"
        },
        "files": {
            "items": {
                "$ref": "#/definitions/objs_file"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
        },
        "icons": {
            "additionalProperties": false,
            "properties": {
                "emoji": {
                    "type": "string"
                },
                "image_64": {
                    "format": "uri",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "inviter": {
            "$ref": "#/definitions/defs_user_id"
        },
        "is_delayed_message": {
            "type": "boolean"
        },
        "is_intro": {
            "type": "boolean"
        },
        "is_starred": {
            "type": "boolean"
        },
        "last_read": {
            "$ref": "#/definitions/defs_ts"
        },
        "latest_reply": {
            "$ref": "#/definitions/defs_ts"
        },
        "name": {
            "type": "string"
        },
        "old_name": {
            "type": "string"
        },
        "parent_user_id": {
            "$ref": "#/definitions/defs_user_id"
        },
        "permalink": {
            "format": "uri",
            "type": "string"
        },
        "pinned_to": {
            "items": {
                "$ref": "#/definitions/defs_channel"
            },
            "type": "array"
        },
        "purpose": {
            "type": "string"
        },
        "reactions": {
            "items": {
                "$ref": "#/definitions/objs_reaction"
            },
            "type": "array"
        },
        "reply_count": {
            "type": "integer"
        },
        "reply_users": {
            "items": {
                "$ref": "#/definitions/defs_user_id"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
        },
        "reply_users_count": {
            "type": "integer"
        },
        "source_team": {
            "$ref": "#/definitions/defs_workspace_id"
        },
        "subscribed": {
            "type": "boolean"
        },
        "subtype": {
            "type": "string"
        },
        "team": {
            "$ref": "#/definitions/defs_workspace_id"
        },
        "text": {
            "type": "string"
        },
        "thread_ts": {
            "$ref": "#/definitions/defs_ts"
        },
        "topic": {
            "type": "string"
        },
        "ts": {
            "$ref": "#/definitions/defs_ts"
        },
        "type": {
            "type": "string"
        },
        "unread_count": {
            "type": "integer"
        },
        "upload": {
            "type": "boolean"
        },
        "user": {
            "$ref": "#/definitions/defs_user_id"
        },
        "user_profile": {
            "$ref": "#/definitions/objs_user_profile_short"
        },
        "user_team": {
            "$ref": "#/definitions/defs_workspace_id"
        },
        "username": {
            "type": "string"
        }
    },
    "required": [
        "text",
        "type",
        "ts"
    ],
    "title": "Message object",
    "type": "object"
}

from slack-php-api.

mpyw avatar mpyw commented on June 11, 2024

Or more accurately, we need to provide another typed implementation for them.

from slack-php-api.

mpyw avatar mpyw commented on June 11, 2024

Diff

Individual

--- objs_message.txt	2022-01-24 11:53:04.000000000 +0900
+++ objs_message_reply_thread.txt	2022-01-24 11:59:33.000000000 +0900
-attachments
-blocks
-bot_id
-bot_profile
-client_msg_id
-comment
-display_as_bot
-file
-files
-icons
-inviter
-is_delayed_message
-is_intro
-is_starred
 last_read
 latest_reply
-name
-old_name
-parent_user_id
-permalink
-pinned_to
-purpose
-reactions
 reply_count
 reply_users
 reply_users_count
 source_team
 subscribed
-subtype
 team
 text
 thread_ts
-topic
 ts
 type
 unread_count
-upload
 user
 user_profile
-username
--- objs_message.txt	2022-01-24 11:53:04.000000000 +0900
+++ objs_message_reply_child.txt	2022-01-24 11:59:53.000000000 +0900
-attachments
-blocks
-bot_id
-bot_profile
-client_msg_id
-comment
-display_as_bot
-file
-files
-icons
-inviter
-is_delayed_message
-is_intro
 is_starred
-last_read
-latest_reply
-name
-old_name
 parent_user_id
-permalink
-pinned_to
-purpose
-reactions
-reply_count
-reply_users
-reply_users_count
 source_team
-subscribed
-subtype
 team
 text
 thread_ts
-topic
 ts
 type
-unread_count
-upload
 user
 user_profile
-user_team
-username

Merged

--- objs_message.txt	2022-01-24 11:53:04.000000000 +0900
+++ objs_message_reply_merged.txt	2022-01-24 11:53:28.000000000 +0900
-attachments
-blocks
-bot_id
-bot_profile
-client_msg_id
-comment
-display_as_bot
-file
-files
-icons
-inviter
-is_delayed_message
-is_intro
 is_starred
 last_read
 latest_reply
-name
-old_name
 parent_user_id
-permalink
-pinned_to
-purpose
-reactions
 reply_count
 reply_users
 reply_users_count
 source_team
 subscribed
-subtype
 team
 text
 thread_ts
-topic
 ts
 type
 unread_count
-upload
 user
 user_profile
 user_team
-username

from slack-php-api.

mpyw avatar mpyw commented on June 11, 2024

Oops, the actual API response structure looks like it includes more (perhaps not all) components of ObjsMessage. It seems to me that there is another major error on slack-api-specs 😢

from slack-php-api.

lyrixx avatar lyrixx commented on June 11, 2024

Hello,

Did you manage to fix your issue? If not, does the latest version fix it?

from slack-php-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.