docs: allow SchemaDocs HTML generator run for one(specific) CDX version#587
Merged
jkowalleck merged 3 commits intomasterfrom Feb 5, 2025
Merged
docs: allow SchemaDocs HTML generator run for one(specific) CDX version#587jkowalleck merged 3 commits intomasterfrom
jkowalleck merged 3 commits intomasterfrom
Conversation
…ating only for one particular CycloneDX version, including the possibility of generating the HTML only for draft version of CycloneDX during dev time. Signed-off-by: Nicolas-Peiffer <102670102+Nicolas-Peiffer@users.noreply.github.com> Fix the deletion of the docs folder Signed-off-by: Nicolas-Peiffer <102670102+Nicolas-Peiffer@users.noreply.github.com> Move deletion of the docs folder to CLI Signed-off-by: Nicolas-Peiffer <102670102+Nicolas-Peiffer@users.noreply.github.com>
…docs/docsgen-one-version-only
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
jvdsn
pushed a commit
to jvdsn/specification
that referenced
this pull request
Feb 23, 2026
Allow the docs generators to run for a certain version. Previously, they always ran for all in series. --- > original from CycloneDX#507 from @Nicolas-Peiffer The JSON Schema HTML viewer generator script `docgen/json/gen.sh` supports generating only for one particular CycloneDX version, including the possibility of generating the HTML only for draft version of CycloneDX during dev time. ## Use Case I want to propose new objects in the CycloneDX Specification. And for checking the JSON Schema, I like to locally use the HTML view to check the content of the JSON Schema. However, during dev time when I was modifying the JSON Schema, I found it not convenient that the script `docgen/json/gen.sh` regenerate the HTML doc for every version of CycloneDX each time I run it when I only need the version I am working on. ## Proposition I modified the script `docgen/json/gen.sh` to be able to run `gen.sh` only for a particular version of CycloneDX. For example: ```bash ./gen.sh 1.6 ``` But I also added a list `DRAFT_CYCLONEDX_VERSIONS` for when I am working on a draft proposition of CycloneDX spec. For example: ```bash # I modify `docgen/json/gen.sh` to add the name of my draft file DRAFT_CYCLONEDX_VERSIONS=(my_cdx_dev_draft) ``` I create a JSON schema draft file `schema/bom-my_cdx_dev_draft.schema.json`: Then I run: ```bash ./gen.sh my_cdx_dev_draft ``` Which creates only the HTML for `my_cdx_dev_draft` ```bash tree docgen/json/docs/my_cdx_dev_draft/ docgen/json/docs/my_cdx_dev_draft/ ├── index.html ├── schema_doc.css └── schema_doc.min.j ``` And in order not to disturb the way `docgen/json/gen.sh` works now, running it without argument generates the HTML for all the CDX versions: ```bash ./gen.sh ``` ```bash ls -1 docgen/json/docs/ 1.2 1.3 1.4 1.5 1.6 ``` I also added a small usage help message. ```bash ./gen.sh -h Deleting folder /home/thedetective/Documents/dev-workspace/cyclonedx/cyclonedx-specification.thalesgroup/docgen/json/docs Usage: Generate HTML JSON Schema navigator for CyccloneDX Usage: ./gen.sh <version> : runs only for <version> ./gen.sh : loops over all valid and draft CycloneDX versions ``` ## What about `docgen/xml/gen.sh` ? I will probably propose the same kind of modification to the XML `docgen/xml/gen.sh` script to achieve the same results. ## Conclusion There are probably other way to achieve this result. I think this one is the cheapest in terms of how the `gen.sh` script is modified. ---- supersedes CycloneDX#507 closes CycloneDX#507
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow the docs generators to run for a certain version.
Previously, they always ran for all in series.
Note
original feature and request #507 from @Nicolas-Peiffer
The JSON Schema HTML viewer generator script
docgen/json/gen.shsupports generating only for one particular CycloneDX version, including the possibility of generating the HTML only for draft version of CycloneDX during dev time.Use Case
I want to propose new objects in the CycloneDX Specification. And for checking the JSON Schema, I like to locally use the HTML view to check the content of the JSON Schema.
However, during dev time when I was modifying the JSON Schema, I found it not convenient that the script
docgen/json/gen.shregenerate the HTML doc for every version of CycloneDX each time I run it when I only need the version I am working on.Proposition
I modified the script
docgen/json/gen.shto be able to rungen.shonly for a particular version of CycloneDX.For example:
But I also added a list
DRAFT_CYCLONEDX_VERSIONSfor when I am working on a draft proposition of CycloneDX spec.For example:
# I modify `docgen/json/gen.sh` to add the name of my draft file DRAFT_CYCLONEDX_VERSIONS=(my_cdx_dev_draft)I create a JSON schema draft file
schema/bom-my_cdx_dev_draft.schema.json:Then I run:
Which creates only the HTML for
my_cdx_dev_draftAnd in order not to disturb the way
docgen/json/gen.shworks now, running it without argument generates the HTML for all the CDX versions:I also added a small usage help message.
What about
docgen/xml/gen.sh?I will probably propose the same kind of modification to the XML
docgen/xml/gen.shscript to achieve the same results.Conclusion
There are probably other way to achieve this result. I think this one is the cheapest in terms of how the
gen.shscript is modified.supersedes #507
closes #507