Giter Site home page Giter Site logo

discourse_api_docs's Introduction

Discourse API Documentation

automatic updates

To view the the Discourse API Documentation you can visit:

https://docs.discourse.org/

Contributing

Contributions are welcome! Start by cloning this repo as well as the discourse repo.

The API docs are automatically generated from the discourse repo using a tool called rswag.

You can generate the openapi.yml file that is located in this repo by running this command from inside of your discourse repo directory:

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

Please do not manually edit the openapi.yml or openapi.json files located in this repo. These files must be edited from the rswag files located in

https://github.com/discourse/discourse/tree/main/spec/requests/api

To view your changes locally, run:

npm install
node server.js

Browse to http://localhost:3001 to see the pretty docs.

Before you push your changes or create a PR convert the yml file to json:

node tojson.js

To verify converting to json worked correctly, please run:

node server.js json

which will load the json file directly instead of live converting the yml file to json. Now browse to http://localhost:3001 and verify your changes still look okay.

Then you can commit your changes and create a PR. This is because we are using github pages to host the static doc website.

Automatic openapi.yml generation

If you are changing multiple API specs in the core Discourse repo, then you can use the bundle exec rake autospec:swagger rake task to watch for changes to files in the spec/requests/api directory. When a change is detected the swaggerize rake task command is run, the openapi.yml file is generated, and node tojson.js is run.

This can all be done while the local API docs server is running for live updates every time API spec files are changed.

Schema Generator

To aid in writing the yml responses in the swagger.yml file use this command to convert actual json responses to a yml schema file:

node toschema.js <input file> <output file>

Example:

node toschema.js responses/topics/topic_respones.json definitions/topics/topic_response.yml

This will convert a json response into json schema and then convert the schema to yml.

discourse_api_docs's People

Contributors

cebe avatar chow89 avatar davidtaylorhq avatar dax74 avatar dependabot[bot] avatar emmanuel-ferdman avatar erlend-sh avatar featheredtoast avatar github-actions[bot] avatar hellekin avatar hossamyoussef2009 avatar jaredreisinger avatar jericson avatar jomaxro avatar kennym avatar martin-brennan avatar mikechristopher avatar oblakeerickson avatar rohitkumbhar avatar samamorgan avatar sau226 avatar scossar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.