From fbb47e146b15adcc303e349f83db38c94bf42846 Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Fri, 4 Nov 2022 15:32:25 -0700 Subject: [PATCH] 14097 update address schema to be consistent --- src/registry_schemas/schemas/address.json | 8 +++++--- src/registry_schemas/version.py | 2 +- tests/unit/test_addresses.py | 12 ++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/registry_schemas/schemas/address.json b/src/registry_schemas/schemas/address.json index 9322f62..9f49da4 100644 --- a/src/registry_schemas/schemas/address.json +++ b/src/registry_schemas/schemas/address.json @@ -10,7 +10,10 @@ "maxLength": 50 }, "streetAddressAdditional": { - "type": "string", + "type": [ + "string", + "null" + ], "maxLength": 50 }, "addressCity": { @@ -43,7 +46,6 @@ "streetAddress", "addressCity", "addressCountry", - "postalCode", - "addressRegion" + "postalCode" ] } diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index 797fed0..23ba688 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '2.15.36' # pylint: disable=invalid-name +__version__ = '2.15.37' # pylint: disable=invalid-name diff --git a/tests/unit/test_addresses.py b/tests/unit/test_addresses.py index 1ec55a6..97d65d9 100644 --- a/tests/unit/test_addresses.py +++ b/tests/unit/test_addresses.py @@ -17,6 +17,8 @@ """ import copy +import pytest + from registry_schemas import validate from registry_schemas.example_data import ADDRESS @@ -63,10 +65,16 @@ def test_invalid_address(): assert not is_valid -def test_invalid_address_missing_region(): +@pytest.mark.parametrize('field', [ + 'streetAddress', + 'addressCity', + 'addressCountry', + 'postalCode' +]) +def test_invalid_address_missing_field(field): """Assert that an invalid address fails - missing required field addressRegion.""" address = copy.deepcopy(ADDRESS) - del address['addressRegion'] + del address[field] is_valid, errors = validate(address, 'address')