Redocly / Redocly/redoc

OpenAPI structure, it's crucial to display operations before webhooks to ensure logical progression

Open
#2,285 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

This approach also helps maintain consistency with established API documentation standards and caters to different user experience levels.

Regarding the ReDoc tool, it's essential to adjust the default order since ReDoc initially displays webhooks before operations. Changing the order improves the overall developer experience by adhering to the recommended structure, making the documentation more intuitive, and ensuring seamless integration with other tools and systems.

  • Stripe API: Stripe is known for its excellent API documentation, which clearly shows operations before webhooks. The well-organized structure allows developers to find relevant information quickly.
    Link: https://stripe.com/docs/api

  • GitHub API: GitHub's API documentation displays operations first, followed by webhooks, making it easy for developers to explore the API and understand its functionalities.
    Link: https://docs.github.com/en/rest

  • Slack API: The Slack API documentation is another good example of the recommended structure, with operations listed before webhooks, making it intuitive and accessible for developers.
    Link: https://api.slack.com/apis

  • Rebilly
    https://api-reference.rebilly.com/tag/Payment-instruments

  • etc

These examples serve as a reference for creating clear and well-structured OpenAPI documentation that prioritizes operations before webhooks, ensuring an optimal developer experience.

I am using ReDoc in two products.

We, along with the developers, tried to find a solution to this problem, conducted an analysis, and realized that in this file, it is necessary to change the order of conditions.

https://github.com/Redocly/redoc/blob/main/src/services/MenuBuilder.ts

To display operations before webhooks, you need to swap the following conditions:
`if (webhooks) {
getTags(parser, webhooks, true);
}

if (spec.paths) {
getTags(parser, spec.paths);
}
`

Here's the modified version:

`if (spec.paths) {
getTags(parser, spec.paths);
}

if (webhooks) {
getTags(parser, webhooks, true);
}
`

By changing the order of these conditions in the file, you ensure that operations are displayed before webhooks, providing a more intuitive and logical structure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/services/MenuBuilder.ts, the file identified in the issue, and inspect how paths and webhooks are added to the menu. The change is complete when operations appear before webhooks in the generated documentation while both remain available; use the repository's existing validation or test commands if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, documentation
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.