-
Notifications
You must be signed in to change notification settings - Fork 0
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
299 improve schema reference #370
Conversation
@jpmckinney please could you check that you're happy with the direction of this PR? I reused a script that I developed for another project to generate an improved schema reference page. You can preview it here: https://standard.open-contracting.org/staging/infrastructure/299-improve-schema-reference/en/reference/schema/. The main changes are to:
The script can be run as part of |
@jpmckinney just checking that you saw this request - thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the command, and each time it keeps adding more content...
Edit: Fixed locally.
manage.py
Outdated
# Add description | ||
definition["content"].extend([ | ||
f"`{defn}` is defined as:\n\n", | ||
"```{jsoninclude-quote} ../../schema/project-level/project-schema.json\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sphinxcontrib-opencontracting already had https://sphinxcontrib-opencontracting.readthedocs.io/en/latest/#field-description before this was added to sphinxcontrib-opendataservices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh! Which would you prefer to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this earlier comment - I prefer field-description
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e65bbf5
|
The command is failing because these don't exist
|
I got
Note this diff after running pre-commit: --- a/docs/_static/i18n.csv
+++ b/docs/_static/i18n.csv
@@ -14,7 +14,7 @@ sector,Project sector,False,
purpose,Project purpose,True,
additionalClassifications,Additional classifications,False,
additionalClassifications,Classification,False,
-additionalClassifications/scheme,Scheme,True,
+additionalClassifications/scheme,Scheme,False,
additionalClassifications/id,ID,True,
additionalClassifications/description,Description,True,
additionalClassifications/uri,URI,False, |
I think we can extract the "this is referenced by" logic to a directive in sphinxcontrib-opencontracting, as suggested in open-contracting/standard#1075 (comment) Otherwise, I think the rest of the logic can't be generalized, as it's mostly code to add directives in a way that's fairly specific to this project (e.g. other projects might prefer a different order or set of directives). |
This might be for a follow-up PR, but I think it'd be nicer to put definitions on separate pages, as suggested in open-contracting/standard#1075 (comment) |
Thanks for the feedback! I take the detailed review to mean that you are happy with the direction of the PR so I will work on your comments and the checklist in the PR description. |
Yup! Direction is good. |
Should we use https://sphinx-design.readthedocs.io/en/rtd-theme/tabs.html instead? |
Ah, yes, even better. |
Noting that I've enabled the |
@jpmckinney do you want to do that before this PR is merged or are you happy for it to live here for now? |
This is mainly recommended so that Markdown syntax highlighters will highlight the Markdown inside the fence (when using backticks, it highlights the whole thing as if it were a code block). If we don't need that highlighting, it'd be simpler to not enable the extension.
We can just create/update issues to do it later. |
@jpmckinney having reviewed the content of
Does that sound good? |
I'm having trouble visualizing what the new example.md page will look like, since if Overview is moved and Sections is removed, I'm not sure what content is left to update – is it just the content at the start of the page? |
Aha, okay - sounds fine to me! |
@jpmckinney this is now ready for review with the exception of the build errors, which relate to the links below. Any idea how to get these to work? infrastructure/docs/guidance/example.md Lines 11 to 13 in 22529f1
I ended up restructuring the worked example page a little so that is better set up for us to add other examples in the future. Happy to hear your feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I committed the fix for the links (drop the part before project-schema.json
).
I made a few comments, but haven't read the bulk of the changes (i.e. example.md, schema.md, and manage.py).
We're at a retreat next week, so I'll try to get back to this when I return
manage.py
Outdated
# Add description | ||
definition["content"].extend([ | ||
f"`{defn}` is defined as:\n\n", | ||
"```{jsoninclude-quote} ../../schema/project-level/project-schema.json\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this earlier comment - I prefer field-description
.
Co-authored-by: James McKinney <[email protected]>
Thanks! I've made those updates. |
@jpmckinney just checking if you would have a chance to complete your review over the next week or two? Thanks! |
In the next week or two, yes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll commit my Python documentation change. I haven't reviewed the code, but I figure it works, and we'll probably change it if needed when we cover open-contracting/sphinxcontrib-opencontracting#33
TO-DO:
manage.py
collapse
parameter ofjsonschema
directivesValue
definition don't appear inexample.json
because they don't make sense in the context of the example:forecasts/0/observations/0/value
metrics/0/observations/0/value
contractingProcesses/0/summary/modifications/0/oldContractValue
contractingProcesses/0/summary/modifications/0/newContractValue
docs/reference/schema.md
to reduce repetition and to identify text that should be added to field descriptionsdocs/guidance/example.md
to identify text that should be moved todocs/reference/schema.md
or to field descriptionsdocs/reference/schema.md