Stash changes

This commit is contained in:
2024-01-07 13:35:22 +01:00
parent aa664dfce1
commit bd30682092
38 changed files with 661 additions and 446 deletions

View File

@@ -18,21 +18,23 @@ import re # noqa: F401
import json
from typing import Any, Dict, Optional
from pydantic import BaseModel, StrictStr
from typing import Any, Dict
from pydantic import BaseModel, Field, StrictStr
from openapi_client.models.entity import Entity
class Service(BaseModel):
"""
Service
"""
uuid: Optional[StrictStr] = '8e285c0c-4e40-430a-a477-26b3b81e30df'
service_name: Optional[StrictStr] = 'Carlos Printing'
service_type: Optional[StrictStr] = '3D Printing'
endpoint_url: Optional[StrictStr] = 'http://127.0.0.1:8000'
status: Optional[StrictStr] = 'unknown'
other: Optional[Dict[str, Any]] = None
entity_did: Optional[StrictStr] = 'did:sov:test:1234'
__properties = ["uuid", "service_name", "service_type", "endpoint_url", "status", "other", "entity_did"]
uuid: StrictStr = Field(...)
service_name: StrictStr = Field(...)
service_type: StrictStr = Field(...)
endpoint_url: StrictStr = Field(...)
status: StrictStr = Field(...)
other: Dict[str, Any] = Field(...)
entity_did: StrictStr = Field(...)
entity: Entity = Field(...)
__properties = ["uuid", "service_name", "service_type", "endpoint_url", "status", "other", "entity_did", "entity"]
class Config:
"""Pydantic configuration"""
@@ -58,6 +60,9 @@ 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()
return _dict
@classmethod
@@ -70,13 +75,14 @@ class Service(BaseModel):
return Service.parse_obj(obj)
_obj = Service.parse_obj({
"uuid": obj.get("uuid") if obj.get("uuid") is not None else '8e285c0c-4e40-430a-a477-26b3b81e30df',
"service_name": obj.get("service_name") if obj.get("service_name") is not None else 'Carlos Printing',
"service_type": obj.get("service_type") if obj.get("service_type") is not None else '3D Printing',
"endpoint_url": obj.get("endpoint_url") if obj.get("endpoint_url") is not None else 'http://127.0.0.1:8000',
"status": obj.get("status") if obj.get("status") is not None else 'unknown',
"uuid": obj.get("uuid"),
"service_name": obj.get("service_name"),
"service_type": obj.get("service_type"),
"endpoint_url": obj.get("endpoint_url"),
"status": obj.get("status"),
"other": obj.get("other"),
"entity_did": obj.get("entity_did") if obj.get("entity_did") is not None else 'did:sov:test:1234'
"entity_did": obj.get("entity_did"),
"entity": Entity.from_dict(obj.get("entity")) if obj.get("entity") is not None else None
})
return _obj