awslabs / aws-api-gateway-developer-portal

A Serverless Developer Portal for easily publishing and cataloging APIs
Apache License 2.0
927 stars 399 forks source link

Allow us to add md file for each displayed api #448

Open yannick-fernand opened 3 years ago

yannick-fernand commented 3 years ago

We would like to share more information about our apis other than from the swagger.

To do so i would like to know if it will be possible to add an md in /custom-content/api-docs for example that will have the name of the api and automatically display the md beside to the swagger

msheaffer commented 3 years ago

@yannick-fernand You may have already figured out a solution to this, but I was able to modify the developer portal to implement this functionality almost exactly as described. Instead of an md file I'm utilizing html for displaying additional content.

In the state.js file there is a function called fetchAPIImage. You can modify or create a duplicate of this function to pull in md or html content in the loop over every api in the apiList using a similar window.fetch call as is used for the api logo. I took that content and put it on each respective api, and then displayed it in the SwaggerUiLayout component using "dangerouslySetInnerHtml".

It's not the greatest solution, and it does have it's issues, but it's functional enough for the time being.