-
Notifications
You must be signed in to change notification settings - Fork 132
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
Replace existing Context pages with JSON schema definitions #1068
Comments
Thanks for raising this @mistryvinay, I made a slight tweak to the description (docs are in 2.1 release and we could either build a viewer or generate static markdown) |
So far the Docusaurus schema browser is displaying some but not all of the JSON data for me. I'm also looking at the Tom Collins repo and will update this post tonight. EDIT 1: I have been using the Docusaurus Playground to see how the action schema renders: The Docusaurus playground shows unsolved refs from the FDC3 Context schema. I have never really used JSON for a project before and am looking into the $ref structure. This user schema from Tom Collins renders without any issues in the Docusaurus Playground: I think using JSON Schema Static generator from Tom Collins to get markdown that renders in Docusaurus will be successful. I will update this post with screenshots. |
that's going better for you than it went for me, then. I couldn't get that Docusaurus plugin going at all |
fat fingers |
Discussed whether it might be better to have a docusaurus plugin, or use a node script. |
I'd suggest to experiment a bit with https://github.com/adobe/jsonschema2md (or similar tools). WDYT? Did anyone had experience with this tool? If we all agree, I'd suggest to proceed with:
@robmoffat @kriswest @mistryvinay - Thoughts? |
Here's an example output from jsonschema2md: The problem is often referencing (in all the different rendering tools), which can result in somewhat difficult to read output or incorporating the entire documentation for the referenced type. Our own experience with generating documentation from this was poor TBH and we ended up rolling our own custom solution. It's not terribly hard to do as the schemas can be imported as JSON objects and processed. The advantage is that it allows you to bake in some knowledge of the how your schemas (and their docs) are structured into the rendering. This results in something inflexible, but better fitted to use case - I briefly ran through the code we use to this and can dig out some excerpts from it if useful. Anyway that's my 2 cents - I worry that adapting a general-purpose tool will take us longer than coming up with custom rendering code (to either HTML or Markdown). |
Thanks for the feedback @kriswest - very helpful. Let's go with the custom solution; I guess that the biggest task here is to define some requirements, for example:
Re. the implementation, I see 2 different directions, and I'd like to hear your opinion:
Eager to hear your thoughts! |
@maoo when we met with Juan and Rob on this I suggested trying to reproduce the existing layouts/markdown, e.g.
You'll note I've replicated all the content from the markdown doc in the schema file for every standardized context already. The only exceptions are:
Re: mapping, the top level title field gives the page title, the description field the initial description:
The same pattern applies to the properties: You do need to descend down the properties object in case there are multiple levels, which is rare, its usually a reference to another type (we don't need to include all the docs for the references just link to their own page). Finally there is an example element in each schema that provides the code block: Had I a spare afternoon (ever), I'd have a go at this as it seems like a fun little script to write ;-) |
@maoo
I proposed these same two options. I would probably start with the former and write a function that generates markdown by parsing the schema and then investigate whether you can improve on it and do it at runtime via react, see: https://docusaurus.io/docs/markdown-features/react. The parsing is going to remain the same, rather its the packaging of it and the output generation (which would be html/react in this latter version). I did wonder about the page routing - you could have one page for all content docs (with anchors for specific ones)... the real problem is the navigation which is currently manually maintained (in this file): https://github.com/finos/FDC3/blob/master/website/sidebars.json Hence, for the sake of a simple life, I'd start with generation at build time - but that's just how I would approach it :-). |
That's my personal preference too, so we're fully aligned; and as you said, we can still reuse the logic and adopt the runtime approach later on. Thanks for the recap, I think that we have everything we need, I'll let @TheJuanAndOnly99 take the lead on this and start playing around with code. |
Enhancement Request
Use Case:
Generate Docusaurus pages for Context types using JSON schema files.
Proposal already created for markdown docs, which can be found here #1020 , which is included as part of release 2.1
Work required
Either:
and:
Additional Information
Discussion around this particular enhancement is being tracked via #940 and #1059
The text was updated successfully, but these errors were encountered: