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

Generate API documentation #745

Closed
3 tasks
mbrookson opened this issue Jul 13, 2020 · 13 comments
Closed
3 tasks

Generate API documentation #745

mbrookson opened this issue Jul 13, 2020 · 13 comments
Labels
Projects

Comments

@mbrookson
Copy link

What do you want and why?

When building a full stack application, it's common for it to grow into something much more. For example, a companion mobile application is often part of a website and backend ecosystem. It would great if Blitz expands to accommodate this use case more and generate easy-to-user documentation or client which can be used to build external clients that utilise the generated Blitz API.

Possible implementation(s)

  • Generate API documentation from the API functions that Blitz generates at build time.
    • This could include all API routes and schema for query strings and POST request bodies.
  • Generate a TypeScript API client so you can just import and start calling the API externally?
    • e.g. Implementations for axios or pure fetch API?
    • Not sure how but even an ability to generate something for use outside of JS? For example what if you wanted to build your app with Flutter?
  • Include examples for common use cases
    • e.g. how to authenticate an external client

Additional context

I have something like swagger.io in mind, however I'm sure it could be far greater!

Example:
https://petstore.swagger.io/?_ga=2.158440947.899930001.1594640979-1996492643.1594640979

@blitzjs-bot blitzjs-bot bot added this to Triage in Dashboard Jul 13, 2020
@flybayer flybayer added kind/feature-change New feature or request status/ready-to-work-on This issue is up for grabs labels Jul 13, 2020
@blitzjs-bot blitzjs-bot bot moved this from Triage to Ready to Work On in Dashboard Jul 13, 2020
@flybayer
Copy link
Member

Thanks @mbrookson, generating API documentation is a great idea! Someone can definitely work on that at anytime.

I also think generating clients is a good idea, but let's keep this issue focused on the docs part.

@merelinguist
Copy link

Love this idea! Might hop on it. @mbrookson Are you looking for a page to be generated, so that people can go to something like localhost:3000/api, or something more like a Markdown file?

@mbrookson
Copy link
Author

@merelinguist A generated page would be ideal and probably more flexible as more functionality could be added in the future I guess? Markdown would be useful still, but doesn't have quite as much potential for further features later on.

@mbrookson
Copy link
Author

@merelinguist Maybe the web page could be driven via a markdown file though? Best of both worlds, plus you could also then choose to do other things with the markdown if you wanted, like generate a client.

@flybayer
Copy link
Member

The other question is how to distribute it. Does it only show during development? In production behind authentication? As a standalone static docs site?

@merelinguist
Copy link

@ryardley Any idea how simple it would be to inject a page like this?

@merelinguist
Copy link

I’d be pretty reticent to have it in production, especially if it’s supposed to be more of a handy dev tool than “here’s a guide to our complete private api”.

@mbrookson
Copy link
Author

Yeah that's an interesting point. Perhaps could be an option? You might want to expose docs for a public API in some instances.

Getting a bit more complex here and just throwing out ideas, but perhaps it could even be per endpoint? Each function could be marked as to whether it should be exposed in public docs. For an initial implementation I'd probably err on the side of caution and keep it private and only available during development.

Also in regards to how it's distributed, standalone would probably be better. Doesn't seem ideal to have to run the application just to be able to view the docs when you're actually only focused on the development of a separate mobile application. On the other hand. Perhaps the docs could be generated using a separate CLI command, run standalone, and be able to be put into a git hook so they can be generated on commit.

@flybayer
Copy link
Member

Ok sounds like it shouldn't even be part of the blitz app. So not as an auto generated page, but as a standalone site.

And seems like maybe there's two main use cases:

  1. blitz docs -> Opens docs in browser with hot reloading
  2. blitz docs export ~/some/path/myDocs -> Exports a full static site that can you can do anything with.

@sakulstra
Copy link

just stepped over this issue. This idea is super cool!

Having a recipe for generating a dokz page as part of the application would be a dream come true, but perhaps for the beginning we could try to generate an openapi yaml/json and offload the integration to the enduser.

@Skn0tt
Copy link
Member

Skn0tt commented Feb 11, 2021

Related discussion: #1907

@bitec-projects
Copy link

Thanks @mbrookson, generating API documentation is a great idea! Someone can definitely work on that at anytime.

I also think generating clients is a good idea, but let's keep this issue focused on the docs part.

Hello! You can see deployd.com this framework that I have been used is fantastic! I developed a full stack based on riot.js, deployd, semantic ui and others... My stack is very simular with blitz.js! I'm studying blitz.js and I'm in love with it :)

@Gnosnay
Copy link

Gnosnay commented Mar 10, 2023

Hi team any progress for this feature?

@blitzjs-bot blitzjs-bot added status/done and removed status/ready-to-work-on This issue is up for grabs labels Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Dashboard
Ready to Work On
Development

No branches or pull requests

8 participants