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

Make schema-derived JSON and YAML files downloadable via docs website #2302

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ $(DOCDIR):

# Compile static Markdown files, images, and JavaScript scripts, into a documentation website.
#
# Then, use `refgraph` (part of `refscan`) to generate a diagram (i.e. a graph that depicts
# Then, copy some additional schema-derived files into the documentation website file tree.
#
# Finally, use `refgraph` (part of `refscan`) to generate a diagram (i.e. a graph that depicts
# inter-collection relationships) in the documentation website's file tree.
gendoc: $(DOCDIR) prefixmaps
# Copy all documentation files to the documentation directory
Expand All @@ -181,6 +183,21 @@ gendoc: $(DOCDIR) prefixmaps
# Create directory for JavaScript files and copy them
mkdir -p $(DOCDIR)/javascripts
$(RUN) cp $(SRC)/scripts/*.js $(DOCDIR)/javascripts/

# Copy additional schema-derived files into the documentation directory.
#
# Note: We use `[-f path]` to check whether the path leads to a file, and we use ` || true` so that — either way —
# the overall command still returns an exit code of `0` (i.e. "success") so GitHub Actions does not abort.
# This `gendoc` target depends upon files generated via the `all` target, and I think this target is sometimes
# being run after some of those things have been deleted. There is a make-based solution to this (i.e.
# identifying inter-target dependence), but that is more of a tangent than I want to take on this
# proof-of-concept branch focused on something else.
#
mkdir -p $(DOCDIR)/downloads
[ -f nmdc_schema/nmdc.schema.json ] && cp nmdc_schema/nmdc.schema.json $(DOCDIR)/downloads/nmdc.schema.json || true
[ -f nmdc_schema/nmdc_materialized_patterns.schema.json ] && cp nmdc_schema/nmdc_materialized_patterns.schema.json $(DOCDIR)/downloads/nmdc_materialized_patterns.schema.json || true
[ -f nmdc_schema/nmdc_materialized_patterns.yaml ] && cp nmdc_schema/nmdc_materialized_patterns.yaml $(DOCDIR)/downloads/nmdc_materialized_patterns.yaml || true

# Use `refgraph` to generate an interactive diagram within the compiled documentation website file tree.
mkdir -p $(DOCDIR)/visualizations
$(RUN) refgraph --schema nmdc_schema/nmdc_materialized_patterns.yaml --subject collection --graph $(DOCDIR)/visualizations/collection-graph.html
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nav:
- Schema element deprecation guide: schema_element_deprecation_guide.md
- v10 vs v11 (Berkeley schema) retrospective: v10-vs-v11-retrospective.md
- Visualizations: visualizations.md
- Downloads: downloads.md


site_url: https://microbiomedata.github.io/nmdc-schema
Expand Down
5 changes: 5 additions & 0 deletions src/docs/downloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Downloads

1. [`nmdc.schema.json`](downloads/nmdc.schema.json)
2. [`nmdc_materialized_patterns.schema.json`](downloads/nmdc_materialized_patterns.schema.json)
3. [`nmdc_materialized_patterns.yaml`](downloads/nmdc_materialized_patterns.yaml)
Loading