Skip to content

Commit

Permalink
Merge pull request #58 from openownership/lib-cove-schema-rename
Browse files Browse the repository at this point in the history
refactor: Rename schema attributes to rm release, as in latest lib-cove
  • Loading branch information
Bjwebb committed Sep 2, 2020
2 parents 049f740 + 3ec8a78 commit 2ed3a91
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.8.0] - 2020-08-28

### Changed

- Rename schema object attributes to remove word "release", as in latest lib-cove

## [0.7.0] - 2020-06-26

### Changed
Expand Down
5 changes: 4 additions & 1 deletion libcovebods/common_checks.py
Expand Up @@ -97,7 +97,10 @@ def common_checks_bods(context, upload_dir, json_data, schema_obj, lib_cove_bods
error['message_safe'] = message_safe

new_validation_errors.append([json.dumps(error), values])
new_validation_errors.sort()
try:
new_validation_errors.sort()
except TypeError:
pass
common_checks['context']['validation_errors'] = new_validation_errors

context.update(common_checks['context'])
Expand Down
10 changes: 5 additions & 5 deletions libcovebods/schema.py
Expand Up @@ -6,25 +6,25 @@ class SchemaBODS(SchemaJsonMixin):
def __init__(self, json_data=None, lib_cove_bods_config=None):
self.lib_cove_bods_config = lib_cove_bods_config
if isinstance(json_data, list) and len(json_data) > 0:
self.schema_version, self.release_pkg_schema_url, self.schema_host = \
self.schema_version, self.pkg_schema_url, self.schema_host = \
self.get_schema_version_of_statement(json_data[0])
else:
self.release_pkg_schema_url = lib_cove_bods_config.config['schema_url']
self.pkg_schema_url = lib_cove_bods_config.config['schema_url']
self.schema_host = lib_cove_bods_config.config['schema_url_host']
self.schema_version = lib_cove_bods_config.config['schema_version']

def get_entity_statement_types_list(self):
for statement_schema in self._release_pkg_schema_obj['items']['oneOf']:
for statement_schema in self._pkg_schema_obj['items']['oneOf']:
if statement_schema['properties']['statementType']['enum'][0] == 'entityStatement':
return statement_schema['properties']['entityType']['enum']

def get_person_statement_types_list(self):
for statement_schema in self._release_pkg_schema_obj['items']['oneOf']:
for statement_schema in self._pkg_schema_obj['items']['oneOf']:
if statement_schema['properties']['statementType']['enum'][0] == 'personStatement':
return statement_schema['properties']['personType']['enum']

def get_ownership_or_control_statement_interest_statement_types_list(self):
for statement_schema in self._release_pkg_schema_obj['items']['oneOf']:
for statement_schema in self._pkg_schema_obj['items']['oneOf']:
if statement_schema['properties']['statementType']['enum'][0] == 'ownershipOrControlStatement':
return statement_schema['properties']['interests']['items']['properties']['type']['enum']

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -2,7 +2,7 @@

setup(
name='libcovebods',
version='0.7.0',
version='0.8.0',
author='Open Data Services',
author_email='code@opendataservices.coop',
url='https://github.com/openownership/lib-cove-bods',
Expand All @@ -13,7 +13,7 @@
'python-dateutil',
'Django>2.2,<2.3',
'flattentool>=0.5.0',
'libcove>=0.17.0'
'libcove>=0.18.0'
],
extras_require={
'dev': ['pytest', 'flake8']
Expand Down

0 comments on commit 2ed3a91

Please sign in to comment.