discourse/spec/requests/api/schemas/json/latest_posts_response.json
Blake Erickson 66c63774ac
DEV: Fix api docs openapi spec validation errors (#35361)
When validating the openapi spec we were getting the following errors:

```
{
  "messages": [
    "attribute paths.'/categories.json'(post).responses.200.content.'application/json'.schema. is not of type `object`",
    "attribute paths.'/categories/{id}.json'(put).responses.200.content.'application/json'.schema. is not of type `object`",
    "attribute paths.'/c/{id}/show.json'(get).responses.200.content.'application/json'.schema. is not of type `object`",
    "attribute paths.'/posts.json'(get).responses.200.content.'application/json'.schema.items is not of type `object`",
    "attribute paths.'/groups/by-id/{id}.json'(get).operationId is repeated"
  ]
}
```

These changes resolve those openapi spec validation errors.

See:
https://github.com/discourse/discourse_api_docs/pull/139#issuecomment-3393138056
2025-10-14 07:32:58 -06:00

307 lines
No EOL
6.7 KiB
JSON

{
"additionalProperties": false,
"properties": {
"latest_posts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": [
"string",
"null"
]
},
"username": {
"type": "string"
},
"avatar_template": {
"type": "string"
},
"created_at": {
"type": "string"
},
"cooked": {
"type": "string"
},
"post_number": {
"type": "integer"
},
"post_type": {
"type": "integer"
},
"posts_count": {
"type": "integer"
},
"updated_at": {
"type": "string"
},
"reply_count": {
"type": "integer"
},
"reply_to_post_number": {
"type": [
"string",
"null"
]
},
"quote_count": {
"type": "integer"
},
"incoming_link_count": {
"type": "integer"
},
"reads": {
"type": "integer"
},
"readers_count": {
"type": "integer"
},
"score": {
"type": "number"
},
"yours": {
"type": "boolean"
},
"topic_id": {
"type": "integer"
},
"topic_slug": {
"type": "string"
},
"topic_title": {
"type": "string"
},
"topic_html_title": {
"type": "string"
},
"category_id": {
"type": "integer"
},
"display_username": {
"type": [
"string",
"null"
]
},
"primary_group_name": {
"type": [
"string",
"null"
]
},
"flair_name": {
"type": [
"string",
"null"
]
},
"flair_url": {
"type": [
"string",
"null"
]
},
"flair_bg_color": {
"type": [
"string",
"null"
]
},
"flair_color": {
"type": [
"string",
"null"
]
},
"flair_group_id": {
"type": [
"string",
"null"
]
},
"badges_granted": {
"type": "array",
"items": {}
},
"version": {
"type": "integer"
},
"can_edit": {
"type": "boolean"
},
"can_delete": {
"type": "boolean"
},
"can_recover": {
"type": "boolean"
},
"can_see_hidden_post": {
"type": "boolean"
},
"can_wiki": {
"type": "boolean"
},
"user_title": {
"type": [
"string",
"null"
]
},
"bookmarked": {
"type": "boolean"
},
"raw": {
"type": "string"
},
"actions_summary": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "integer"
},
"can_act": {
"type": "boolean"
}
},
"required": [
"id",
"can_act"
]
}
},
"moderator": {
"type": "boolean"
},
"admin": {
"type": "boolean"
},
"staff": {
"type": "boolean"
},
"user_id": {
"type": "integer"
},
"hidden": {
"type": "boolean"
},
"trust_level": {
"type": "integer"
},
"deleted_at": {
"type": [
"string",
"null"
]
},
"user_deleted": {
"type": "boolean"
},
"edit_reason": {
"type": [
"string",
"null"
]
},
"can_view_edit_history": {
"type": "boolean"
},
"wiki": {
"type": "boolean"
},
"excerpt": {
"type": "string"
},
"truncated": {
"type": "boolean"
},
"reviewable_id": {
"type": [
"string",
"null"
]
},
"reviewable_score_count": {
"type": "integer"
},
"reviewable_score_pending_count": {
"type": "integer"
},
"post_url": {
"type": "string"
}
},
"required": [
"id",
"name",
"username",
"avatar_template",
"created_at",
"cooked",
"post_number",
"post_type",
"posts_count",
"updated_at",
"reply_count",
"reply_to_post_number",
"quote_count",
"incoming_link_count",
"reads",
"readers_count",
"score",
"yours",
"topic_id",
"topic_slug",
"topic_title",
"topic_html_title",
"category_id",
"display_username",
"primary_group_name",
"flair_name",
"flair_url",
"flair_bg_color",
"flair_color",
"flair_group_id",
"badges_granted",
"version",
"can_edit",
"can_delete",
"can_recover",
"can_see_hidden_post",
"can_wiki",
"user_title",
"bookmarked",
"raw",
"actions_summary",
"moderator",
"admin",
"staff",
"user_id",
"hidden",
"trust_level",
"deleted_at",
"user_deleted",
"edit_reason",
"can_view_edit_history",
"wiki",
"excerpt",
"truncated",
"reviewable_id",
"reviewable_score_count",
"reviewable_score_pending_count",
"post_url"
]
}
}
},
"required": [
"latest_posts"
]
}