@@ -82,12 +82,19 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
8282 type = FileType ('wt' , encoding = 'utf8' ),
8383 dest = 'outfile' ,
8484 default = '-' )
85- op .add_argument ('--sv' , '-- schema-version' ,
85+ op .add_argument ('--schema-version' , # DEPRECATED
8686 metavar = '<version>' ,
87- help = 'The CycloneDX schema version for your SBOM'
87+ help = 'DEPRECATED alias for option "--spec-version".' ,
88+ dest = 'spec_version' ,
89+ choices = SchemaVersion ,
90+ type = SchemaVersion .from_version ,
91+ default = SchemaVersion .V1_5 .to_version ())
92+ op .add_argument ('--sv' , '--spec-version' ,
93+ metavar = '<version>' ,
94+ help = 'The CycloneDX spec version for your SBOM'
8895 f' {{choices: { ", " .join (sorted ((v .to_version () for v in SchemaVersion ), reverse = True ))} }}'
8996 ' (default: %(default)s)' ,
90- dest = 'schema_version ' ,
97+ dest = 'spec_version ' ,
9198 choices = SchemaVersion ,
9299 type = SchemaVersion .from_version ,
93100 default = SchemaVersion .V1_5 .to_version ())
@@ -150,7 +157,7 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
150157
151158 __OWN_ARGS = {
152159 # the arg keywords from __init__()
153- 'logger' , 'short_purls' , 'output_format' , 'schema_version ' , 'output_reproducible' , 'should_validate' ,
160+ 'logger' , 'short_purls' , 'output_format' , 'spec_version ' , 'output_reproducible' , 'should_validate' ,
154161 # the arg keywords from __call__()
155162 'outfile'
156163 }
@@ -163,15 +170,15 @@ def __init__(self, *,
163170 logger : logging .Logger ,
164171 short_purls : bool ,
165172 output_format : OutputFormat ,
166- schema_version : SchemaVersion ,
173+ spec_version : SchemaVersion ,
167174 output_reproducible : bool ,
168175 should_validate : bool ,
169176 _bbc : Type ['BomBuilder' ],
170177 ** kwargs : Any ) -> None :
171178 self ._logger = logger
172179 self ._short_purls = short_purls
173180 self ._output_format = output_format
174- self ._schema_version = schema_version
181+ self ._spec_version = spec_version
175182 self ._output_reproducible = output_reproducible
176183 self ._should_validate = should_validate
177184 self ._bbc = _bbc (** self ._clean_kwargs (kwargs ),
@@ -206,17 +213,17 @@ def _validate(self, output: str) -> bool:
206213 self ._logger .warning ('Validation skipped.' )
207214 return False
208215
209- self ._logger .info ('Validating result to schema : %s/%s' ,
210- self ._schema_version .to_version (), self ._output_format .name )
216+ self ._logger .info ('Validating result to spec : %s/%s' ,
217+ self ._spec_version .to_version (), self ._output_format .name )
211218
212219 validation_error = make_schemabased_validator (
213220 self ._output_format ,
214- self ._schema_version
221+ self ._spec_version
215222 ).validate_str (output )
216223 if validation_error :
217224 self ._logger .debug ('Validation Errors: %r' , validation_error .data )
218225 self ._logger .error ('The result is invalid to schema '
219- f'{ self ._schema_version .to_version ()} /{ self ._output_format .name } ' )
226+ f'{ self ._spec_version .to_version ()} /{ self ._output_format .name } ' )
220227 self ._logger .warning ('Please report the issue and provide all input data to: '
221228 'https://github.com/CycloneDX/cyclonedx-python/issues/new?'
222229 'template=ValidationError-report.md&'
@@ -232,7 +239,7 @@ def _write(self, output: str, outfile: TextIO) -> int:
232239 return written
233240
234241 def _make_output (self , bom : 'Bom' ) -> str :
235- self ._logger .info ('Serializing SBOM: %s/%s' , self ._schema_version .to_version (), self ._output_format .name )
242+ self ._logger .info ('Serializing SBOM: %s/%s' , self ._spec_version .to_version (), self ._output_format .name )
236243
237244 if self ._output_reproducible :
238245 bom .metadata .properties .add (Property (name = PropertyName .Reproducible .value ,
@@ -244,7 +251,7 @@ def _make_output(self, bom: 'Bom') -> str:
244251 return make_outputter (
245252 bom ,
246253 self ._output_format ,
247- self ._schema_version
254+ self ._spec_version
248255 ).output_as_string (indent = 2 )
249256
250257 def _make_bom (self , ** kwargs : Any ) -> 'Bom' :
0 commit comments