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

New gencode schema index page with categorisation #436

Merged
merged 17 commits into from
Sep 5, 2022

Conversation

noursaidi
Copy link
Collaborator

Example - https://noursaidi.github.io/udmi/gencode/docs/

This change intends to make the schema browser easier to use now that there are a lot more defined schemas.

Changes:

  • Schema is now automatically generated for any page which is a "root" schema (not referenced by another schema file) or deliberately excluded (event.json). This prevents pages being created for state_pointset etc.
  • Use MD file rather than HTML file
  • Use categorisation. If a schema is given a category in etc/schema_categories.txt then it'll be placed unread that category , otherwise it's lodged into the Other category
  • Add description of schema to the page

@noursaidi noursaidi requested a review from grafnu August 31, 2022 13:25
Copy link
Collaborator

@grafnu grafnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put together noursaidi#14 to try some things out -- if you like them you can/should merge that PR into your branch, and then we'll merge them all into faucetsdn...

@@ -0,0 +1,7 @@
event_pointset Messages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid the name "category" for this, since it's overloaded then with docs/specs/categories.md -- when I first saw this I was expecting something else. Section? schema_sections.txt or something would be ok I think! Alternatively, how hard would it be to have the section specified in the schema file itself? We could have a special field "$section" and just pull the value from there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be easy to do. I did think about this, but wasn't sure if JSON Schema permits additional keywords not defined in the schema? (assuming we want to remain compliant with JSON Schema)? The only existing keyword which could be used was $comment

@@ -0,0 +1,92 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to "gencode_schemas"? I'm trying to have at least some logical structure... bin/ is getting crowded, so having some structure there would be helpful, I think!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add it into a script called gencode_doc_utils along with other gendoc related scripts to reduce the number of those? I don't think gencode_schemas is a good name for this particular script.

Incidentally .. I was planning to split the HTML documentation generation out of gendocs and calling that gencode_schemas because gencode_docs itself is getting messy to work with

@@ -0,0 +1,9 @@
[**UDMI**](../../) / [Schema](#)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema_readme.md (just because it maps to readme.md not index.md). Also, maybe add an in there somewhere that explains where this ends up? Just so if somebody is looking at this they have some hint!

@grafnu
Copy link
Collaborator

grafnu commented Aug 31, 2022 via email

@@ -6,6 +6,22 @@

The schema documentation in [`gencode/docs`](../../gencode/docs) must be kept up to date with any changes to the schema. Any additions to the schema should also include [annotations](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) to describe the new elements. The updated documentation is generated by running the script `bin/gendocs` and its output committed to the repository with the changes. Required python dependencies are in [`etc/requirements.txt`](../../etc/requirements.txt) which must be installed for the script to run.

### Troubleshooting

If these tests are failing, check you are using a compatible system (Linux with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: Prefer not 1st person language for docs. E.g., "If these tests are failing, check the basic system requirements (Linux with...) -- Just a style thing trying to avoid the tutorial mode of writing. Or like below ("If..., check...") is ok (just avoid you/I/we is all :-).

@@ -0,0 +1,97 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending file name change

@noursaidi
Copy link
Collaborator Author

@grafnu file renamed and documentation updated, PTAL

@noursaidi noursaidi merged commit f9dce43 into faucetsdn:master Sep 5, 2022
noursaidi added a commit to noursaidi/udmi that referenced this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants