Skip to content
Merged
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
23 changes: 10 additions & 13 deletions cdxev/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,31 +447,22 @@ def create_validation_parser(
group = parser.add_mutually_exclusive_group()
group.add_argument(
"--schema-type",
help=(
"Decide whether to use the default specification of CycloneDX or a custom schema. "
"The version will be derived from the specVersion in the provided SBOM. "
"If no version is provided defaults to 1.3."
),
help="Use a built-in schema for validation.",
Comment thread
italvi marked this conversation as resolved.
choices=["default", "strict", "custom"],
default="default",
)
group.add_argument(
"--schema-path",
metavar="<schema-path>",
help=(
"Path to a JSON schema to use for validator. "
"If it's not specified, the program will try"
" to use one of the embedded schemata."
),
type=str,
help="Path to the JSON schema file to validate against.",
type=Path,
)

group = parser.add_mutually_exclusive_group()
group.add_argument(
"--filename-pattern",
help=(
"Regex for validation of filename. If not specified, a default regex depending on "
"the schema-type is applied. To disable filename validation altogether, use "
"the schema is applied. To disable filename validation altogether, use "
"--no-filename-validation."
),
default="",
Expand Down Expand Up @@ -865,6 +856,12 @@ def invoke_validate(args: argparse.Namespace) -> int:
args.parser,
)

if args.schema_type is None and args.schema_path is None:
# Default to built-in stock schema. This case can't be handled by argparse
# due to an undocumented behavior which keeps options with default values
# from working correctly in mutually exclusive groups.
args.schema_type = "default"

sbom, file_type = read_sbom(args.input)
return (
Status.OK
Expand Down
247 changes: 0 additions & 247 deletions cdxev/auxiliary/schema/bom-1.0.xsd

This file was deleted.

Loading