shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.14k stars 1.22k forks source link

Interactive API docs theme for Nextra #1380

Open raproid opened 1 year ago

raproid commented 1 year ago

Public API is a core part of almost any online service.

Nextra is missing an API docs theme that is interactive and sleek, just like the Docs theme.

Here's an example of what I'm talking about: https://preview.readme.io/reference/post_ankr-getaccountbalance?url=https%3A%2F%2Fsanjose.api.ankrscan.io%2Fdocs%2Fswagger.json

We were able to embed a non-interactive API ref via Redocly: https://www.ankr.com/docs/advanced-api/specification/ It's still missing a lot of things, from interactivity, when you can click "Try it" and send a live request, getting a live response, to a matching theme.

Would be amazing to have some interactive API docs theme in Nextra, one that can eat a full .json/.yaml API spec file and render interactive API docs from it.

raproid commented 1 year ago

@B2o5T here you go, as requested.

dimaMachina commented 1 year ago

Public API is a core part of almost any online service.

Public REST API / swagger API is outside of the context of the docs theme

Nextra is missing an API docs theme that is interactive and sleek, just like the Docs theme.

It can be done via custom themes for Nextra, but it should not be included in the current nextra-theme-docs. Because the purpose of the docs theme is to describe documentation and not add a Playground for REST or GraphQL API.

markcmurphy commented 1 year ago

Look into Rapidoc. They're web components and so they currently can't be SSR, but the number of features makes it the best choice for us. We're building a new dev center, here's a prototype: https://deploy-preview-4--bigcommerce-dev-center.netlify.app/api-specs/management-apis/customers/brands/post#get-/catalog/brands

raproid commented 1 year ago

@markcmurphy Could I contact you on Telegram maybe to consult with concerning the API docs you mentioned? My handle there is @raproid

The example looks like something I can showcase to my PM and persuade him not to move our API docs to readme.io but o integrate them into our existing docs on Nextra. 

What I'm failing to understand and want to know is the mechanics of your integration. I can see the "api-specs" path in https://deploy-preview-4--bigcommerce-dev-center.netlify.app/api-specs/management-apis/customers/brands/post#get-/catalog/brands but I cannot find in the main branch of https://github.com/bigcommerce/dev-docs to see the source code and understand how you integrated Rapidoc into your Nextra setup.

raproid commented 1 year ago

@markcmurphy or could you simply point me to the branch and the file where I can see the integration? So I can try to do it in a similar manner.

shuding commented 1 year ago

I think we can find a good swagger UI library for React and use it in Nextra directly. What's the blocker?

raproid commented 1 year ago

https://openapi.tools/ here's a full list of available tools for OAPI.

minskim0327 commented 10 months ago

Is this still a valid issue? Any ways to integrate public APIs into nextra?

timmyjose commented 9 months ago

I had the exact same question, and I see that this issue is still open. Pity.

danilopeixoto commented 4 months ago

The rendered content may not need to be interactive. Do we have something similar to npm/docusaurus-plugin-openapi-docs for Nextra?

catalinpit commented 1 month ago

npm/docusaurus-plugin-openapi-docs

This would be really good!