0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/spec/requests/api/schemas/json/search_response.json
Natalie Tay 9e99066b07
DEV: Expand top_tags, topic.tags, etc, to return an array of tag objects instead of tag names (#36678)
Currently in several endpoints, we return an array of strings for tags.
Our goal with this PR is to expand array tag name strings to an array of
tag objects.

#### before: Tags were returned as string arrays
```
{ "tags": ["support", "bug-report"] }
```

#### after: Tags are returned as object arrays
```
{ "tags": [{"id": 12, "name": "support", "slug": "support"}, {"id": 13, "name": "bug-report", "slug": "bug-report"}] }
```

This allows us to start referencing tags by their ids, and return more
information for a tag for future features.

This commit involves updating several areas:
- topic lists (/latest.json, /top.json, /c/:category/:id.json, etc, for
`top_tags`)
- tag chooser components (`MiniTagChooser`, `TagDrop`, etc)
- topic view (/t/:id.json)
- tag groups (/tag_groups.json, tags, parent_tag)
- category settings
- staff action logs
- synonyms
- ...

APIs that reference tags based on their names will still be supported
with a deprecation warning. Moving on, we will reference them using
their tag ids.
2026-02-02 10:03:02 +08:00

156 lines
2.7 KiB
JSON
Vendored

{
"additionalProperties": false,
"properties": {
"posts": {
"type": "array",
"items": {
}
},
"users": {
"type": "array",
"items": {
}
},
"categories": {
"type": "array",
"items": {
}
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
}
},
"required": ["id", "name", "slug"]
}
},
"groups": {
"type": "array",
"items": {
}
},
"grouped_search_result": {
"type": "object",
"additionalProperties": false,
"properties": {
"more_posts": {
"type": [
"string",
"null"
]
},
"more_users": {
"type": [
"string",
"null"
]
},
"more_categories": {
"type": [
"string",
"null"
]
},
"term": {
"type": "string"
},
"search_log_id": {
"type": "integer"
},
"more_full_page_results": {
"type": [
"string",
"null"
]
},
"can_create_topic": {
"type": "boolean"
},
"error": {
"type": [
"string",
"null"
]
},
"extra": {
"type": "object",
"properties": {
"categories": {
"type": [
"array",
"null"
]
}
}
},
"post_ids": {
"type": "array",
"items": {
}
},
"user_ids": {
"type": "array",
"items": {
}
},
"category_ids": {
"type": "array",
"items": {
}
},
"tag_ids": {
"type": "array",
"items": {
}
},
"group_ids": {
"type": "array",
"items": {
}
}
},
"required": [
"more_posts",
"more_users",
"more_categories",
"term",
"search_log_id",
"more_full_page_results",
"can_create_topic",
"error",
"post_ids",
"user_ids",
"category_ids",
"tag_ids",
"group_ids"
]
}
},
"required": [
"posts",
"users",
"categories",
"tags",
"groups",
"grouped_search_result"
]
}