Skip to content

Commit

Permalink
Ensure pydantic AnyUrl values are converted to fairgraph IRIs
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Oct 8, 2024
1 parent 6ebd87a commit 220a132
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions validation_service_api/validation_service/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ def from_kg_object(cls, instance, client, model_id, scope):

def to_kg_object(self, model_project):
repository = omcore.FileRepository(
name=self.source,
iri=self.source,
name=str(self.source),
iri=IRI(str(self.source)),
#hosted_by=
#repository_type=
hash=omcore.Hash(algorithm="SHA-1", digest=self.hash) # are we sure we're using SHA-1?
Expand Down Expand Up @@ -1220,7 +1220,7 @@ def to_kg_object(self, client):
return omcore.File(
id=client.uri_from_uuid(self.id) if self.id else None,
name=self.local_path,
iri=IRI(self.download_url),
iri=IRI(str(self.download_url)),
format=get_term("ContentType", self.content_type),
hash=omcore.Hash(algorithm="SHA-1", digest=self.hash), # are we sure we're using SHA-1?
storage_size=self.size,
Expand Down
13 changes: 13 additions & 0 deletions validation_service_api/validation_service/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ The token should be stored in an environment variable `VF_TEST_TOKEN`.
- pytest
- pytest-asyncio

## Environment

The following environment variables need to be set:

- KG_SERVICE_ACCOUNT_CLIENT_ID
- KG_SERVICE_ACCOUNT_SECRET
- EBRAINS_IAM_BASE_URL
- EBRAINS_IAM_CLIENT_ID
- EBRAINS_IAM_SECRET
- SESSIONS_SECRET_KEY
- KG_CORE_API_HOST
- VALIDATION_SERVICE_BASE_URL

## Running tests

From the "validation_service_api" subdirectory, run:
Expand Down

0 comments on commit 220a132

Please sign in to comment.