Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sorting decorators (like old Redoc had) #38

Merged
merged 16 commits into from
Oct 23, 2024
Merged

Add sorting decorators (like old Redoc had) #38

merged 16 commits into from
Oct 23, 2024

Conversation

lornajane
Copy link
Contributor

Adds some of the sorting features that older versions of open source Redoc (v1 and v2) could apply at display time so that they can be used at any stage of the API lifecycle.

@thesteve0
Copy link

Does this also include a custom rule to specify the order expected by the linter?

@lornajane
Copy link
Contributor Author

I don't have a rule for the method ordering included, but I think we can add one.

@adamaltman
Copy link
Member

I agree that it should accept a config for method order (maybe it can have a default for zero config). I can see particular people wanting to go in some specific order though which might not be alphabetical (such as DELETE last).

@thesteve0
Copy link

thesteve0 commented Aug 23, 2024 via email

@lornajane lornajane requested a review from Oprysk August 28, 2024 10:44
Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments from the code style prospective.

@adamaltman
Copy link
Member

Shall we push this one through to completion? Seems powerful.

@lornajane
Copy link
Contributor Author

@adamaltman Definitely! Want to take another look? I added the extra rules we discussed.

@thesteve0 I added a method-sort rule that I hope will do what you need, let me know if you get chance to try it?

PathItem: {
enter(pathItem, ctx) {
// default method sort order, can be changed with an "order" param in config
let methodOrder = ["post", "patch", "put", "get", "delete"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add head, options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't on the basis that it's configurable so here's a very mainstream starter set and people can work on it from there. Although now you mention it, maybe "get" should be first!

@lornajane lornajane merged commit d155441 into main Oct 23, 2024
2 checks passed
@lornajane lornajane deleted the sorting branch October 23, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants