jolicode / slack-php-api

:hash: PHP Slack Client based on the official OpenAPI specification
https://jolicode.github.io/slack-php-api/
MIT License
221 stars 54 forks source link

Required fields in `Objs*` classes should not be nullable #141

Open mpyw opened 2 years ago

mpyw commented 2 years ago
{
  "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"
}

It shows that the following fields are required.

But the implementations are like this:

public function getType(): ?string
{
    return $this->type;
}

public function getText(): ?string
{
    return $this->text;
}

public function getTs(): ?string
{
    return $this->ts;
}

I have a question:

lyrixx commented 1 year ago

Hello,

Sorry for the very late reply.

Did you manage to solve your issue?