slackapi / slack-api-specs

Open API specifications for platform products by Slack
MIT License
222 stars 64 forks source link

85 validation errors reported in Swagger Editor #63

Open krissirk opened 3 years ago

krissirk commented 3 years ago

Description

I copy/pasted the contents of https://api.slack.com/specs/openapi/v2/slack_web.json into Swagger Editor (auto-conversion of JSON to YAML) and have found that there are 85 validation errors throw:

https://app.swaggerhub.com/apis/krissirk/slack-web/1.0#/

Similar to the impact reported in this GitHub issue, the presence of these issues in the spec inhibits our customers' ability to consume the JSON as-is and successfully make callouts + work with the API response in the Salesforce External Services feature.

As an example, the "chat_postMessage" operation 200 response references "objs_message" object, which contains a seemingly malformed property definition "bot_id": image

This property definition doesn't specify "type" and it's using an array for "items". As a result, our callout runtime from Salesforce Flow fails to process the response as it does not match the spec.

There are four other "bot_id" references defined in the spec as

"bot_id": { "$ref": "#/definitions/defs_bot_id" }

If the above definition is used instead of

"bot_id": { "items": [ { "$ref": "#/definitions/defs_bot_id" }, { "title": "Nil bot_id set when display_as_bot is false", "type": "null" } ] } within "objs_message", or (just like the Swagger validator indicates) it could be made an “object” with the "title" and "reference" under it, our callout runtime will succeed.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

Swagger Tools; Salesforce Platform

Steps to reproduce:

  1. Copy https://api.slack.com/specs/openapi/v2/slack_web.json
  2. Paste into Swagger Editor
  3. Accept conversion from JSON to YAML
  4. Observe 85 errors reported in the Swagger UI

Expected result:

No validation errors when the spec is viewed in Swagger Editor. Codegen with the spec as input succeeds. Salesforce automation via External Services + Flow succeeds.

Actual result:

85 validation errors reported by Swagger Editor.

Error throw by API response in debug during demo - skip to ~15:00 of https://www.salesforce.com/video/19792276.

Attachments:

demo problem

rholzhause commented 2 years ago

Unfortunately this blocks a lot of use cases of generating clients for that particular API. Are there any plans on resolving these issues?

rholzhause commented 2 years ago

In case somebody else has the same issue to generate clients from that spec, I have just found a clean OpenAPI 3.0.0 of the Slack Web API v1.7.0 which has no semantic errors. It's maintained by the APIs-guru community and can be found in https://github.com/APIs-guru/openapi-directory/blob/main/APIs/slack.com/1.7.0/openapi.yaml