2424
2525from .._internal .bom_ref import bom_ref_from_str as _bom_ref_from_str
2626from .._internal .compare import ComparableTuple as _ComparableTuple
27- from ..schema .schema import SchemaVersion1Dot6
27+ from ..schema .schema import SchemaVersion1Dot5 , SchemaVersion1Dot6
2828from . import XsUri
2929from .bom_ref import BomRef
3030
@@ -49,7 +49,7 @@ def __init__(
4949 postal_code : Optional [str ] = None ,
5050 street_address : Optional [str ] = None ,
5151 ) -> None :
52- self ._bom_ref = _bom_ref_from_str (bom_ref , optional = True )
52+ self ._bom_ref = _bom_ref_from_str (bom_ref )
5353 self .country = country
5454 self .region = region
5555 self .locality = locality
@@ -58,11 +58,11 @@ def __init__(
5858 self .street_address = street_address
5959
6060 @property
61- @serializable .json_name ('bom-ref' )
6261 @serializable .type_mapping (BomRef )
6362 @serializable .xml_attribute ()
6463 @serializable .xml_name ('bom-ref' )
65- def bom_ref (self ) -> Optional [BomRef ]:
64+ @serializable .json_name ('bom-ref' )
65+ def bom_ref (self ) -> BomRef :
6666 """
6767 An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be
6868 unique within the BOM.
@@ -167,7 +167,7 @@ def __comparable_tuple(self) -> _ComparableTuple:
167167 self .country , self .region , self .locality , self .postal_code ,
168168 self .post_office_box_number ,
169169 self .street_address ,
170- None if self .bom_ref is None else self . bom_ref .value ,
170+ self ._bom_ref .value ,
171171 ))
172172
173173 def __eq__ (self , other : object ) -> bool :
@@ -199,14 +199,33 @@ class OrganizationalContact:
199199
200200 def __init__ (
201201 self , * ,
202+ bom_ref : Optional [Union [str , BomRef ]] = None ,
202203 name : Optional [str ] = None ,
203204 phone : Optional [str ] = None ,
204205 email : Optional [str ] = None ,
205206 ) -> None :
207+ self ._bom_ref = _bom_ref_from_str (bom_ref )
206208 self .name = name
207209 self .email = email
208210 self .phone = phone
209211
212+ @property
213+ @serializable .view (SchemaVersion1Dot5 )
214+ @serializable .view (SchemaVersion1Dot6 )
215+ @serializable .type_mapping (BomRef )
216+ @serializable .xml_attribute ()
217+ @serializable .xml_name ('bom-ref' )
218+ @serializable .json_name ('bom-ref' )
219+ def bom_ref (self ) -> BomRef :
220+ """
221+ An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be
222+ unique within the BOM.
223+
224+ Returns:
225+ `BomRef`
226+ """
227+ return self ._bom_ref
228+
210229 @property
211230 @serializable .xml_sequence (1 )
212231 @serializable .xml_string (serializable .XmlStringSerializationType .NORMALIZED_STRING )
@@ -257,7 +276,8 @@ def phone(self, phone: Optional[str]) -> None:
257276
258277 def __comparable_tuple (self ) -> _ComparableTuple :
259278 return _ComparableTuple ((
260- self .name , self .email , self .phone
279+ self .name , self .email , self .phone ,
280+ self ._bom_ref .value ,
261281 ))
262282
263283 def __eq__ (self , other : object ) -> bool :
@@ -289,16 +309,35 @@ class OrganizationalEntity:
289309
290310 def __init__ (
291311 self , * ,
312+ bom_ref : Optional [Union [str , BomRef ]] = None ,
292313 name : Optional [str ] = None ,
293314 urls : Optional [Iterable [XsUri ]] = None ,
294315 contacts : Optional [Iterable [OrganizationalContact ]] = None ,
295316 address : Optional [PostalAddress ] = None ,
296317 ) -> None :
318+ self ._bom_ref = _bom_ref_from_str (bom_ref )
297319 self .name = name
298320 self .address = address
299321 self .urls = urls or []
300322 self .contacts = contacts or []
301323
324+ @property
325+ @serializable .view (SchemaVersion1Dot5 )
326+ @serializable .view (SchemaVersion1Dot6 )
327+ @serializable .type_mapping (BomRef )
328+ @serializable .xml_attribute ()
329+ @serializable .xml_name ('bom-ref' )
330+ @serializable .json_name ('bom-ref' )
331+ def bom_ref (self ) -> BomRef :
332+ """
333+ An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be
334+ unique within the BOM.
335+
336+ Returns:
337+ `BomRef`
338+ """
339+ return self ._bom_ref
340+
302341 @property
303342 @serializable .xml_sequence (10 )
304343 @serializable .xml_string (serializable .XmlStringSerializationType .NORMALIZED_STRING )
@@ -367,7 +406,8 @@ def contacts(self, contacts: Iterable[OrganizationalContact]) -> None:
367406
368407 def __comparable_tuple (self ) -> _ComparableTuple :
369408 return _ComparableTuple ((
370- self .name , _ComparableTuple (self .urls ), _ComparableTuple (self .contacts )
409+ self .name , _ComparableTuple (self .urls ), _ComparableTuple (self .contacts ),
410+ self ._bom_ref .value ,
371411 ))
372412
373413 def __eq__ (self , other : object ) -> bool :
0 commit comments