|
21 | 21 | from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator |
22 | 22 | from typing import Any, ClassVar, Dict, List, Optional |
23 | 23 | from onfido.models.document_properties_address_lines import DocumentPropertiesAddressLines |
24 | | -from onfido.models.document_properties_barcode import DocumentPropertiesBarcode |
| 24 | +from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner |
25 | 25 | from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification |
26 | 26 | from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner |
27 | 27 | from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation |
@@ -76,7 +76,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel): |
76 | 76 | real_id_compliance: Optional[StrictBool] = None |
77 | 77 | security_tier: Optional[StrictStr] = None |
78 | 78 | address_lines: Optional[DocumentPropertiesAddressLines] = None |
79 | | - barcode: Optional[DocumentPropertiesBarcode] = None |
| 79 | + barcode: Optional[List[DocumentPropertiesBarcodeInner]] = None |
80 | 80 | nfc: Optional[DocumentPropertiesNfc] = None |
81 | 81 | driving_licence_information: Optional[DocumentPropertiesDrivingLicenceInformation] = None |
82 | 82 | document_classification: Optional[DocumentPropertiesDocumentClassification] = None |
@@ -171,9 +171,13 @@ def to_dict(self) -> Dict[str, Any]: |
171 | 171 | # override the default output from pydantic by calling `to_dict()` of address_lines |
172 | 172 | if self.address_lines: |
173 | 173 | _dict['address_lines'] = self.address_lines.to_dict() |
174 | | - # override the default output from pydantic by calling `to_dict()` of barcode |
| 174 | + # override the default output from pydantic by calling `to_dict()` of each item in barcode (list) |
| 175 | + _items = [] |
175 | 176 | if self.barcode: |
176 | | - _dict['barcode'] = self.barcode.to_dict() |
| 177 | + for _item_barcode in self.barcode: |
| 178 | + if _item_barcode: |
| 179 | + _items.append(_item_barcode.to_dict()) |
| 180 | + _dict['barcode'] = _items |
177 | 181 | # override the default output from pydantic by calling `to_dict()` of nfc |
178 | 182 | if self.nfc: |
179 | 183 | _dict['nfc'] = self.nfc.to_dict() |
@@ -253,7 +257,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
253 | 257 | "real_id_compliance": obj.get("real_id_compliance"), |
254 | 258 | "security_tier": obj.get("security_tier"), |
255 | 259 | "address_lines": DocumentPropertiesAddressLines.from_dict(obj["address_lines"]) if obj.get("address_lines") is not None else None, |
256 | | - "barcode": DocumentPropertiesBarcode.from_dict(obj["barcode"]) if obj.get("barcode") is not None else None, |
| 260 | + "barcode": [DocumentPropertiesBarcodeInner.from_dict(_item) for _item in obj["barcode"]] if obj.get("barcode") is not None else None, |
257 | 261 | "nfc": DocumentPropertiesNfc.from_dict(obj["nfc"]) if obj.get("nfc") is not None else None, |
258 | 262 | "driving_licence_information": DocumentPropertiesDrivingLicenceInformation.from_dict(obj["driving_licence_information"]) if obj.get("driving_licence_information") is not None else None, |
259 | 263 | "document_classification": DocumentPropertiesDocumentClassification.from_dict(obj["document_classification"]) if obj.get("document_classification") is not None else None, |
|
0 commit comments