Is there a way to order SmartDocs API resource paths and verbs like they are in the OAS?

I'm creating multiple APIs that follow a consistent pattern in my Open API Spec, but that order is not preserved. I tried setting sort criteria in "Nodes Method Listing (Content)" in "Model Index Page details" to work around, but using:

  • Resource Path (asc)
  • HTTP verb (asc)

doesn't seem to work. The order I get is:

  • GET /persons
  • POST /persons
  • GET /persons/{id}
  • PUT /persons/{id}
  • DELETE /persons({id}
  • PATCH /persons/{id}
0 6 241
6 REPLIES 6

Because the OpenAPI uses a map of resources, there isn't any order like you would have with an array. SmartDocs renders these by alphabetical order of paths, then by verbs. I don't believe there is a way to force another ordering.

If you want to group APIs, you should be able to use tags to collect paths together into something more intuitive.

Thanks for the insight. I do use tags to group APIs by functional area (e.g. accounts, orders) but within those groupings, the order is not deterministic, which as an engineer, keeps me awake at night.

It appears even the order by path and verb isn't working.

You can use the DraggableViews Drupal module to enable custom sorting: https://www.drupal.org/project/draggableviews

With this module, you create a new view that lets you drag and drop your methods to order them. Then you set other views to use that view as their sort criteria.

Like @Bennett Hansen said, the display of SmartDocs uses Drupal Views which makes it completely customizable from the admin interface.

OK, I'll dig into it, I'm a bit of a newbie to DevPortal config, so will let you know how it goes.

Happy to help if you run into issues.