为Discourse API文档做出贡献

:bookmark: This is a guide for contributing to the official Discourse API documentation.

:person_raising_hand: Required user level: Developer

:gear: Console access required

Do you want to contribute to the official API documentation at https://docs.discourse.org? This guide will explain step by step how to do it.

Summary

This documentation will guide you through the following steps:

  • Setting up prerequisites.
  • Cloning the Discourse API documentation repository.
  • Editing the API documentation files.
  • Viewing your changes locally.
  • Creating a pull request.

Prerequisites

You must have a Discourse development installation. If you don’t have one, follow the guide that suits your environment in these topics.

Cloning the Discourse API docs repository

Assuming your Discourse development installation is inside your home directory ~/, proceed with the following steps to clone the repository:

  1. From your home directory, clone the repository at https://github.com/discourse/discourse_api_docs:

    git clone https://github.com/discourse/discourse_api_docs
    
  2. You should now have the discourse and discourse_api_docs folders side by side:

    ~/discourse/
    ~/discourse_api_docs/
    

Editing the API documentation files

You must edit the documentation directly from ~/discourse/spec/requests/api/.

After editing the documentation files, run the following command from ~/discourse/:

bin/rake rswag:specs:swaggerize && cp openapi/openapi.yaml ~/discourse_api_docs/openapi.yaml

The documentation will be generated using rswag and copied into ~/discourse_api_docs/.

Viewing your changes locally

To view your updated documentation, follow these steps:

  1. From ~/discourse_api_docs/, run:

    npm install
    node server.js
    
  2. Browse to http://localhost:3001 to see the updated documentation.

Creating a pull request

Once you verify that everything looks good, create a pull request from the discourse/discourse repository (not the Discourse API Docs repository).

Common issues and solutions

Reporting errors in Discourse API documentation

If you encounter issues or errors in the Discourse API documentation, please report them on the Discourse Meta forum - you can follow the bug report guide to help you do this effectively.

Additional resources

Last edited by @hugh 2024-06-11T05:08:16Z

Check documentPerform check on document:
15 个赞

如何报告 discourse api 文档中的错误

api 文档的 Github 存储库没有激活 issues 选项卡

你好,欢迎你 @srinivas.chilukuri :slight_smile:
你可以在这里举报。 :+1: 出了什么问题?

2 个赞

参考 : Discourse API 文档 获取群组

操作:群组/获取群组

  • 在文档中,路径参数显示为 id,但查询时该路径不存在。
  • 通过 Discourse UI 反向工程相同的查询时,路径参数为 name,并且通过 API 密钥查询时该参数有效。

2 个赞

3个帖子被拆分到一个新主题:Document basic-info api endpoint