diff --git a/hsmodels/schemas/base_models.py b/hsmodels/schemas/base_models.py index fafc611..f83676c 100644 --- a/hsmodels/schemas/base_models.py +++ b/hsmodels/schemas/base_models.py @@ -100,7 +100,7 @@ def schema_extra(schema: Dict[str, Any], model) -> None: "title": "Key-Value", "description": "A key-value pair", "default": [], - "properties": {"key": {"type": "string"}, "value": {"type": "string"}} + "properties": {"key": {"type": "string"}, "value": {"type": "string"}}, } diff --git a/hsmodels/schemas/fields.py b/hsmodels/schemas/fields.py index 11835c8..b7150a3 100644 --- a/hsmodels/schemas/fields.py +++ b/hsmodels/schemas/fields.py @@ -173,7 +173,8 @@ class Config: @classmethod def from_user(cls, user): user_dict = user.dict() - user_dict["description"] = user.url.path + hydroshare_user_id = user.url.path.split("/")[-2] + user_dict["hydroshare_user_id"] = hydroshare_user_id if user.website: user_dict["homepage"] = user.website @@ -232,7 +233,8 @@ def from_user(cls, user): :return: a Contributor """ user_dict = user.dict() - user_dict["hydroshare_user_id"] = user.id + hydroshare_user_id = user.url.path.split("/")[-2] + user_dict["hydroshare_user_id"] = hydroshare_user_id if user.website: user_dict["homepage"] = user.website diff --git a/hsmodels/schemas/resource.py b/hsmodels/schemas/resource.py index 24a7e2f..1ee6a74 100644 --- a/hsmodels/schemas/resource.py +++ b/hsmodels/schemas/resource.py @@ -24,7 +24,7 @@ split_coverages, split_dates, ) -from hsmodels.schemas.validators import list_not_empty, parse_identifier, parse_spatial_coverage +from hsmodels.schemas.validators import list_not_empty, parse_identifier, parse_spatial_coverage class ResourceMetadataIn(BaseMetadata): diff --git a/setup.py b/setup.py index b3c5713..a830b05 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='hsmodels', - version='0.5.1', + version='0.5.2', packages=find_packages(include=['hsmodels', 'hsmodels.*', 'hsmodels.schemas.*', 'hsmodels.schemas.rdf.*'], exclude=("tests",)), install_requires=[ diff --git a/tests/test_schemas.py b/tests/test_schemas.py index a19e16a..89642d9 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -81,5 +81,5 @@ def test_dictionary_field(additional_metadata_field): "title": "Key-Value", "description": "A key-value pair", "default": [], - "properties": {"key": {"type": "string"}, "value": {"type": "string"}} + "properties": {"key": {"type": "string"}, "value": {"type": "string"}}, }