docson icon indicating copy to clipboard operation
docson copied to clipboard

Feature Request: CLI tool to generate a static website given a schema

Open AbdulRahmanAlHamali opened this issue 6 years ago • 9 comments

Hello,

Thank you for the tool. It produces the best schema docs out there!

But I have a problem: I don't want my doc website to accept a schema as a parameter and then generate its doc dynamically. Instead, I want to have some CLI tool (nodejs tool maybe?) that accepts the schema, and generates a static website out of it. Would there be a way to refactor your code to make it do just that? I don't think it is too much of a hassle, what do you guys think?

one other option that does not require refactoring is to have a (docker image maybe?) that hosts the app on some server, and then communicates with it using Selenium (web browser simulator) and provides it with the Schema, then stores the generated page as a static website.

The reason why I am interested in a static page is that I have a humongous schema, and the tool takes about 5 seconds to generate it each time a user opens the docs. But if it were static, it would have been much faster.

AbdulRahmanAlHamali avatar May 31 '19 11:05 AbdulRahmanAlHamali

I'll have a look after the week-end. I would also think that there should be a way to do that via run-the-app-and-grab-output-via-Selenium/Puppeteer, but I'll have to verify that hypothesis. :-)

yanick avatar May 31 '19 13:05 yanick

alright thank you Yanick, have a good weekend!

AbdulRahmanAlHamali avatar May 31 '19 20:05 AbdulRahmanAlHamali

any news on this? This would be the most useful thing. Currently, it takes upwards of 10 seconds just to load the schema docs page. To be able to generate it and have a static version for people to look at would be fantastic.

jcbedard avatar Jun 04 '19 13:06 jcbedard

I kind of mulling over porting the core of docson to either Vue or React. If I do that, it'd become pretty easy to produce pre-generated versions of the schema via nuxt / next.

Hmm... I'll try to cut a next branch today, and poke around to see how much work that'd be.

yanick avatar Jun 04 '19 13:06 yanick

Is there anything new about this request? I am also interested in this feature.

kaflake avatar Jun 05 '20 06:06 kaflake

There is! ... after a fashion.

There is a very early, not working yet new project https://github.com/yanick/jsonschematic that is meant to be inspired by docson, but written in Svelte. If that project gets off the ground, that will make things like offline rendering much easier.

yanick avatar Jun 05 '20 14:06 yanick

There is also another library: https://github.com/coveooss/json-schema-for-humans

Which we use at work, and it is working great so far :)

AbdulRahmanAlHamali avatar Jun 08 '20 14:06 AbdulRahmanAlHamali

Oooh. Thanks for pointing json-schema-for-humans! I've added a SIMILAR TOOLS sections to the README, and seeded the section with that link.

yanick avatar Jun 13 '20 15:06 yanick

Thank you for the answers. json-schema-for-humans work perfect for me.

kaflake avatar Jun 18 '20 04:06 kaflake