From 390ded6dff67d30b207a09a6f4e401ae5d59b64a Mon Sep 17 00:00:00 2001 From: Luis-Hebendanz Date: Mon, 15 Jan 2024 15:57:31 +0100 Subject: [PATCH] Fixed missing entity_did in ServiceBase --- pkgs/clan-cli/clan_cli/webui/schemas.py | 4 +--- pkgs/clan-cli/tests/openapi_client/docs/Service.md | 2 +- pkgs/clan-cli/tests/openapi_client/models/service.py | 10 +++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/webui/schemas.py b/pkgs/clan-cli/clan_cli/webui/schemas.py index ba1e7ac..e2508b9 100644 --- a/pkgs/clan-cli/clan_cli/webui/schemas.py +++ b/pkgs/clan-cli/clan_cli/webui/schemas.py @@ -100,15 +100,14 @@ class ServiceBase(BaseModel): other: dict = Field( ..., example={"action": ["register", "deregister", "delete", "create"]} ) + entity_did: str = Field(..., example="did:sov:test:120") class ServiceCreate(ServiceBase): - entity_did: str = Field(..., example="did:sov:test:120") usage: List[ServiceUsageCreate] class Service(ServiceBase): - entity: Entity usage: List[ServiceUsage] class Config: @@ -116,7 +115,6 @@ class Service(ServiceBase): class ServicesByName(BaseModel): - entity: Entity services: List[Service] class Config: diff --git a/pkgs/clan-cli/tests/openapi_client/docs/Service.md b/pkgs/clan-cli/tests/openapi_client/docs/Service.md index de14631..023e28c 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/Service.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/Service.md @@ -10,7 +10,7 @@ | **endpoint_url** | **str** | | | **status** | **str** | | | **other** | **object** | | -| **entity** | [**Entity**](Entity.md) | | +| **entity_did** | **str** | | | **usage** | [**List[ServiceUsage]**](ServiceUsage.md) | | ## Example diff --git a/pkgs/clan-cli/tests/openapi_client/models/service.py b/pkgs/clan-cli/tests/openapi_client/models/service.py index 68b5784..18fab79 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/service.py +++ b/pkgs/clan-cli/tests/openapi_client/models/service.py @@ -20,7 +20,6 @@ import json from typing import Any, Dict, List from pydantic import BaseModel, Field, StrictStr, conlist -from openapi_client.models.entity import Entity from openapi_client.models.service_usage import ServiceUsage class Service(BaseModel): @@ -33,9 +32,9 @@ class Service(BaseModel): endpoint_url: StrictStr = Field(...) status: StrictStr = Field(...) other: Dict[str, Any] = Field(...) - entity: Entity = Field(...) + entity_did: StrictStr = Field(...) usage: conlist(ServiceUsage) = Field(...) - __properties = ["uuid", "service_name", "service_type", "endpoint_url", "status", "other", "entity", "usage"] + __properties = ["uuid", "service_name", "service_type", "endpoint_url", "status", "other", "entity_did", "usage"] class Config: """Pydantic configuration""" @@ -61,9 +60,6 @@ class Service(BaseModel): exclude={ }, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of entity - if self.entity: - _dict['entity'] = self.entity.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in usage (list) _items = [] if self.usage: @@ -89,7 +85,7 @@ class Service(BaseModel): "endpoint_url": obj.get("endpoint_url"), "status": obj.get("status"), "other": obj.get("other"), - "entity": Entity.from_dict(obj.get("entity")) if obj.get("entity") is not None else None, + "entity_did": obj.get("entity_did"), "usage": [ServiceUsage.from_dict(_item) for _item in obj.get("usage")] if obj.get("usage") is not None else None }) return _obj