# وثائق Discourse openapi.json لا تتبع مواصفات OpenAPI 3.1.0

**URL:** <https://meta.discourse.org/t/discourse-openapi-json-docs-does-not-follow-openapi-3-1-0-spec/268932>\
**Category:** Bug\
**Tags:** rest-api\
**Created:** [19 يونيو 2023، 6:06م UTC](https://meta.discourse.org/t/discourse-openapi-json-docs-does-not-follow-openapi-3-1-0-spec/268932 "2023-06-19T18:06:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyle-ye/32/309787_2.png) [@Kyle-Ye](https://meta.discourse.org/u/Kyle-Ye)\
**Post date:** [19 يونيو 2023، 6:15م UTC](https://meta.discourse.org/t/discourse-openapi-json-docs-does-not-follow-openapi-3-1-0-spec/268932/2 "2023-06-19T18:15:01Z")

</div>

يتم إنشاء openapi.json الخاص بـ Discourse بواسطة أداة تسمى [rswag](https://github.com/rswag/rswag)

ربما تكون هذه مشكلة في المصدر. وعندما يقوم المصدر بإصلاحها، يجب علينا ترقية إصدار التبعية وتحديث ملفات التوثيق المقابلة.

> <https://github.com/rswag/rswag/issues/647>
>
> \## Describe the bug
> 
> \[Discourse API Docs\](https://github.com/discourse/discour…se\_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\](https://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\](https://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.
> 
> \- Clone https://github.com/discourse/discourse and generated the latest docs \`rake rswag:specs:swaggerize\` (Or use https://github.com/discourse/discourse\_api\_docs directly)
> \- The generated openapi.json is not a valid OpenAPI doc and will make https://github.com/mattpolzin/OpenAPIKit throw an error when parsing it.
> 
> \## Expected behavior
> 
> Geneate a valid openapi.json and openapi.yml file.
> 
> \## Additional context
> 
> See full context here https://github.com/mattpolzin/OpenAPIKit/issues/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)
> \- \[x\] OAS3.1

---

_[View the full topic](https://meta.discourse.org/t/discourse-openapi-json-docs-does-not-follow-openapi-3-1-0-spec/268932)._
