How to customize smart doc with a new module like slate, swagger ui or ...

Not applicable

Hi, I need to customize smart docs on dev portal(Drupal 7). So far I have tried following modules : swagger-ui-formatter, slate, acquia-slate

None of them have proper documentation, so it’s difficult to configure, and the desired styling is not achievable.

Editing individual template file for each proxy isn't a possible solution, as I want to customize the documentation of APIs and not just the summary page or method listing.

I prefer using slate for customization but there is no proper documentation on how to enable or configure it with dev portal.

Can you suggest any module or other way except manually editing each template?

@Daniel Johnson

2 1 576
1 REPLY 1

Hi @TheodrosAyichiluhm

I'll start off by saying that you don't need to customize individual template files for each proxy (though this is possible). If you upload a new smartdocs.hbr template at admin/config/smartdocs under "Advanced settings" and "Upload customized method template" - this will be applied to all methods. This is the recommended way to customize the SmartDocs Method page. Also see https://docs.apigee.com/api-platform/publish/drupal/using-smartdocs-document-apis under "Editing the SmartDocs template".

Now for the modules you mentioned.

slate and acquia-slate Drupal modules are not related to API documentation at all - these are just modules with the same name as https://github.com/lord/slate. There is no effort to integrate the Slate documentation library with Drupal that I'm aware of.

swagger_ui_formatter module does work however. These are working instructions for how to use it: https://www.drupal.org/docs/7/modules/swagger-ui-field-formatter/configure-the-module.

Using a module like swagger_ui_formatter or even Slate comes with a big problem however: you are losing SmartDocs' integration with Edge. For example, SmartDocs uses a proxy url for the "try-it-now" function to avoid CORS problems. Using swagger_ui_formatter or Slate, you take on this responsibility yourself. You are also not using the built-in Model taxonomy and SmartDocs Method content types, or any of the built-in Views that make use of those elements.