rswag/rswag

[BUG] Generated openapi file does not full satisfy the spec

Kyle-Ye opened this issue · 1 comments

Describe the bug

Discourse API Docs use Rswag 2.9.0 to generate the OpneAPI file.

But the generated file is not full satisfy OpenAPI spec.

"schema": {
  "additionalProperties": false,
  "properties": {
    "form_template_ids": {
      "items": [], ❌
      "type": "array"
    }
  },
  "required": []
}

That schema does not look valid to me. The items key for an array schema "MUST be a valid JSON Schema" (json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.1.2-1) and a JSON Schema "MUST be an object or a boolean" (json-schema.org/draft/2020-12/json-schema-core.html#section-4.3-2). Because this part of the OpenAPI Document is governed by JSON Schema rules, they likely don't bother mentioning too many of those rules inside the OpenAPI specification itself.

Steps to Test or Reproduce

Please provide an example repo or the steps to reproduce the behavior.

Expected behavior

Geneate a valid openapi.json and openapi.yml file.

Additional context

See full context here mattpolzin/OpenAPIKit#277

Dependency versions

The version of are you using for:

  • Rswag: 2.9.0
  • RSpec:
  • Rails:
  • Ruby:

Relates to which version of OAS (OpenAPI Specification)

  • OAS3.1

The problem will be fixed downstream. discourse/discourse#22256