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

XML Schema HTML viewer generator script supports generating for one particular CDX version #508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nicolas-Peiffer
Copy link
Contributor

The XML Schema HTML viewer generator script docgen/xml/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.

See also a similar PR for JSON: #507

Use Case

I want to propose new objects in the CycloneDX Specification. And for checking the XML XSD Schema, I like to locally use the HTML view to check the content of the XSD.

However, I found it not convenient that the script docgen/xml/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/xml/gen.sh to be able to run gen.sh only for a particular version of CycloneDX.

For example:

./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:

# I modify `docgen/xml/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.xsd:

Then I run:

./gen.sh my_cdx_dev_draft

Which creates only the HTML for my_cdx_dev_draft

tree docgen/xml/
docgen/xml/
├── docs
│   └── 1.6
│       └── index.html
├── gen.sh
├── Saxon-HE-9.9.1-8.jar
└── xs3p.xsl

And in order not to disturb the way docgen/xml/gen.sh works now, running it without argument generates the HTML for all the CDX versions:

./gen.sh
ls -1 docgen/xml/docs/
1.0
1.1
1.2
1.3
1.4
1.5
1.6

I also added a small usage help message.

./gen.sh -h
Usage: Generate HTML XML Schema navigator for CyccloneDX
Usage: ./gen.sh <version> : runs only for <version>
       ./gen.sh           : loops over all valid and draft CycloneDX versions

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.

@Nicolas-Peiffer Nicolas-Peiffer requested a review from a team as a code owner August 29, 2024 12:59
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.

1 participant