generated from Luis/nextjs-python-web-template
Generate python client for tests
This commit is contained in:
26
pkgs/clan-cli/tests/openapi_client/models/__init__.py
Normal file
26
pkgs/clan-cli/tests/openapi_client/models/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
# import models into model package
|
||||
from openapi_client.models.entity import Entity
|
||||
from openapi_client.models.entity_create import EntityCreate
|
||||
from openapi_client.models.http_validation_error import HTTPValidationError
|
||||
from openapi_client.models.machine import Machine
|
||||
from openapi_client.models.resolution import Resolution
|
||||
from openapi_client.models.service import Service
|
||||
from openapi_client.models.service_create import ServiceCreate
|
||||
from openapi_client.models.status import Status
|
||||
from openapi_client.models.validation_error import ValidationError
|
||||
from openapi_client.models.validation_error_loc_inner import ValidationErrorLocInner
|
||||
81
pkgs/clan-cli/tests/openapi_client/models/entity.py
Normal file
81
pkgs/clan-cli/tests/openapi_client/models/entity.py
Normal file
@@ -0,0 +1,81 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, Field, StrictBool, StrictStr
|
||||
|
||||
class Entity(BaseModel):
|
||||
"""
|
||||
Entity
|
||||
"""
|
||||
did: Optional[StrictStr] = 'did:sov:test:1234'
|
||||
name: Optional[StrictStr] = 'C1'
|
||||
ip: Optional[StrictStr] = '127.0.0.1'
|
||||
visible: Optional[StrictBool] = True
|
||||
other: Optional[Dict[str, Any]] = None
|
||||
attached: StrictBool = Field(...)
|
||||
__properties = ["did", "name", "ip", "visible", "other", "attached"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Entity:
|
||||
"""Create an instance of Entity from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Entity:
|
||||
"""Create an instance of Entity from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return Entity.parse_obj(obj)
|
||||
|
||||
_obj = Entity.parse_obj({
|
||||
"did": obj.get("did") if obj.get("did") is not None else 'did:sov:test:1234',
|
||||
"name": obj.get("name") if obj.get("name") is not None else 'C1',
|
||||
"ip": obj.get("ip") if obj.get("ip") is not None else '127.0.0.1',
|
||||
"visible": obj.get("visible") if obj.get("visible") is not None else True,
|
||||
"other": obj.get("other"),
|
||||
"attached": obj.get("attached")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
79
pkgs/clan-cli/tests/openapi_client/models/entity_create.py
Normal file
79
pkgs/clan-cli/tests/openapi_client/models/entity_create.py
Normal file
@@ -0,0 +1,79 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictBool, StrictStr
|
||||
|
||||
class EntityCreate(BaseModel):
|
||||
"""
|
||||
EntityCreate
|
||||
"""
|
||||
did: Optional[StrictStr] = 'did:sov:test:1234'
|
||||
name: Optional[StrictStr] = 'C1'
|
||||
ip: Optional[StrictStr] = '127.0.0.1'
|
||||
visible: Optional[StrictBool] = True
|
||||
other: Optional[Dict[str, Any]] = None
|
||||
__properties = ["did", "name", "ip", "visible", "other"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> EntityCreate:
|
||||
"""Create an instance of EntityCreate from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> EntityCreate:
|
||||
"""Create an instance of EntityCreate from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return EntityCreate.parse_obj(obj)
|
||||
|
||||
_obj = EntityCreate.parse_obj({
|
||||
"did": obj.get("did") if obj.get("did") is not None else 'did:sov:test:1234',
|
||||
"name": obj.get("name") if obj.get("name") is not None else 'C1',
|
||||
"ip": obj.get("ip") if obj.get("ip") is not None else '127.0.0.1',
|
||||
"visible": obj.get("visible") if obj.get("visible") is not None else True,
|
||||
"other": obj.get("other")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel, conlist
|
||||
from openapi_client.models.validation_error import ValidationError
|
||||
|
||||
class HTTPValidationError(BaseModel):
|
||||
"""
|
||||
HTTPValidationError
|
||||
"""
|
||||
detail: Optional[conlist(ValidationError)] = None
|
||||
__properties = ["detail"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> HTTPValidationError:
|
||||
"""Create an instance of HTTPValidationError from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in detail (list)
|
||||
_items = []
|
||||
if self.detail:
|
||||
for _item in self.detail:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
_dict['detail'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> HTTPValidationError:
|
||||
"""Create an instance of HTTPValidationError from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return HTTPValidationError.parse_obj(obj)
|
||||
|
||||
_obj = HTTPValidationError.parse_obj({
|
||||
"detail": [ValidationError.from_dict(_item) for _item in obj.get("detail")] if obj.get("detail") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
74
pkgs/clan-cli/tests/openapi_client/models/machine.py
Normal file
74
pkgs/clan-cli/tests/openapi_client/models/machine.py
Normal file
@@ -0,0 +1,74 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
from openapi_client.models.status import Status
|
||||
|
||||
class Machine(BaseModel):
|
||||
"""
|
||||
Machine
|
||||
"""
|
||||
name: StrictStr = Field(...)
|
||||
status: Status = Field(...)
|
||||
__properties = ["name", "status"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Machine:
|
||||
"""Create an instance of Machine from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Machine:
|
||||
"""Create an instance of Machine from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return Machine.parse_obj(obj)
|
||||
|
||||
_obj = Machine.parse_obj({
|
||||
"name": obj.get("name"),
|
||||
"status": obj.get("status")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
81
pkgs/clan-cli/tests/openapi_client/models/resolution.py
Normal file
81
pkgs/clan-cli/tests/openapi_client/models/resolution.py
Normal file
@@ -0,0 +1,81 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, Field, StrictInt, StrictStr
|
||||
|
||||
class Resolution(BaseModel):
|
||||
"""
|
||||
Resolution
|
||||
"""
|
||||
requester_name: Optional[StrictStr] = 'C1'
|
||||
requester_did: Optional[StrictStr] = 'did:sov:test:1122'
|
||||
resolved_did: Optional[StrictStr] = 'did:sov:test:1234'
|
||||
other: Optional[Dict[str, Any]] = None
|
||||
timestamp: datetime = Field(...)
|
||||
id: StrictInt = Field(...)
|
||||
__properties = ["requester_name", "requester_did", "resolved_did", "other", "timestamp", "id"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Resolution:
|
||||
"""Create an instance of Resolution from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Resolution:
|
||||
"""Create an instance of Resolution from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return Resolution.parse_obj(obj)
|
||||
|
||||
_obj = Resolution.parse_obj({
|
||||
"requester_name": obj.get("requester_name") if obj.get("requester_name") is not None else 'C1',
|
||||
"requester_did": obj.get("requester_did") if obj.get("requester_did") is not None else 'did:sov:test:1122',
|
||||
"resolved_did": obj.get("resolved_did") if obj.get("resolved_did") is not None else 'did:sov:test:1234',
|
||||
"other": obj.get("other"),
|
||||
"timestamp": obj.get("timestamp"),
|
||||
"id": obj.get("id")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
83
pkgs/clan-cli/tests/openapi_client/models/service.py
Normal file
83
pkgs/clan-cli/tests/openapi_client/models/service.py
Normal file
@@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class Service(BaseModel):
|
||||
"""
|
||||
Service
|
||||
"""
|
||||
uuid: Optional[StrictStr] = '8e285c0c-4e40-430a-a477-26b3b81e30df'
|
||||
service_name: Optional[StrictStr] = 'Carlo's 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"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Service:
|
||||
"""Create an instance of Service from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Service:
|
||||
"""Create an instance of Service from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
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 'Carlo's 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',
|
||||
"other": obj.get("other"),
|
||||
"entity_did": obj.get("entity_did") if obj.get("entity_did") is not None else 'did:sov:test:1234'
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
83
pkgs/clan-cli/tests/openapi_client/models/service_create.py
Normal file
83
pkgs/clan-cli/tests/openapi_client/models/service_create.py
Normal file
@@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class ServiceCreate(BaseModel):
|
||||
"""
|
||||
ServiceCreate
|
||||
"""
|
||||
uuid: Optional[StrictStr] = '8e285c0c-4e40-430a-a477-26b3b81e30df'
|
||||
service_name: Optional[StrictStr] = 'Carlo's 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"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> ServiceCreate:
|
||||
"""Create an instance of ServiceCreate from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> ServiceCreate:
|
||||
"""Create an instance of ServiceCreate from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return ServiceCreate.parse_obj(obj)
|
||||
|
||||
_obj = ServiceCreate.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 'Carlo's 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',
|
||||
"other": obj.get("other"),
|
||||
"entity_did": obj.get("entity_did") if obj.get("entity_did") is not None else 'did:sov:test:1234'
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
41
pkgs/clan-cli/tests/openapi_client/models/status.py
Normal file
41
pkgs/clan-cli/tests/openapi_client/models/status.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
from aenum import Enum, no_arg
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Status(str, Enum):
|
||||
"""
|
||||
An enumeration.
|
||||
"""
|
||||
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
ONLINE = 'online'
|
||||
OFFLINE = 'offline'
|
||||
UNKNOWN = 'unknown'
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Status:
|
||||
"""Create an instance of Status from a JSON string"""
|
||||
return Status(json.loads(json_str))
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import List
|
||||
from pydantic import BaseModel, Field, StrictStr, conlist
|
||||
from openapi_client.models.validation_error_loc_inner import ValidationErrorLocInner
|
||||
|
||||
class ValidationError(BaseModel):
|
||||
"""
|
||||
ValidationError
|
||||
"""
|
||||
loc: conlist(ValidationErrorLocInner) = Field(...)
|
||||
msg: StrictStr = Field(...)
|
||||
type: StrictStr = Field(...)
|
||||
__properties = ["loc", "msg", "type"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> ValidationError:
|
||||
"""Create an instance of ValidationError from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in loc (list)
|
||||
_items = []
|
||||
if self.loc:
|
||||
for _item in self.loc:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
_dict['loc'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> ValidationError:
|
||||
"""Create an instance of ValidationError from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return ValidationError.parse_obj(obj)
|
||||
|
||||
_obj = ValidationError.parse_obj({
|
||||
"loc": [ValidationErrorLocInner.from_dict(_item) for _item in obj.get("loc")] if obj.get("loc") is not None else None,
|
||||
"msg": obj.get("msg"),
|
||||
"type": obj.get("type")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
FastAPI
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import json
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field, StrictInt, StrictStr, ValidationError, validator
|
||||
from typing import Union, Any, List, TYPE_CHECKING
|
||||
from pydantic import StrictStr, Field
|
||||
|
||||
VALIDATIONERRORLOCINNER_ANY_OF_SCHEMAS = ["int", "str"]
|
||||
|
||||
class ValidationErrorLocInner(BaseModel):
|
||||
"""
|
||||
ValidationErrorLocInner
|
||||
"""
|
||||
|
||||
# data type: str
|
||||
anyof_schema_1_validator: Optional[StrictStr] = None
|
||||
# data type: int
|
||||
anyof_schema_2_validator: Optional[StrictInt] = None
|
||||
if TYPE_CHECKING:
|
||||
actual_instance: Union[int, str]
|
||||
else:
|
||||
actual_instance: Any
|
||||
any_of_schemas: List[str] = Field(VALIDATIONERRORLOCINNER_ANY_OF_SCHEMAS, const=True)
|
||||
|
||||
class Config:
|
||||
validate_assignment = True
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
if args:
|
||||
if len(args) > 1:
|
||||
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||
if kwargs:
|
||||
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||
super().__init__(actual_instance=args[0])
|
||||
else:
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@validator('actual_instance')
|
||||
def actual_instance_must_validate_anyof(cls, v):
|
||||
instance = ValidationErrorLocInner.construct()
|
||||
error_messages = []
|
||||
# validate data type: str
|
||||
try:
|
||||
instance.anyof_schema_1_validator = v
|
||||
return v
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
# validate data type: int
|
||||
try:
|
||||
instance.anyof_schema_2_validator = v
|
||||
return v
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
if error_messages:
|
||||
# no match
|
||||
raise ValueError("No match found when setting the actual_instance in ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
|
||||
else:
|
||||
return v
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> ValidationErrorLocInner:
|
||||
return cls.from_json(json.dumps(obj))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> ValidationErrorLocInner:
|
||||
"""Returns the object represented by the json string"""
|
||||
instance = ValidationErrorLocInner.construct()
|
||||
error_messages = []
|
||||
# deserialize data into str
|
||||
try:
|
||||
# validation
|
||||
instance.anyof_schema_1_validator = json.loads(json_str)
|
||||
# assign value to actual_instance
|
||||
instance.actual_instance = instance.anyof_schema_1_validator
|
||||
return instance
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
# deserialize data into int
|
||||
try:
|
||||
# validation
|
||||
instance.anyof_schema_2_validator = json.loads(json_str)
|
||||
# assign value to actual_instance
|
||||
instance.actual_instance = instance.anyof_schema_2_validator
|
||||
return instance
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
|
||||
if error_messages:
|
||||
# no match
|
||||
raise ValueError("No match found when deserializing the JSON string into ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
|
||||
else:
|
||||
return instance
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the actual instance"""
|
||||
if self.actual_instance is None:
|
||||
return "null"
|
||||
|
||||
to_json = getattr(self.actual_instance, "to_json", None)
|
||||
if callable(to_json):
|
||||
return self.actual_instance.to_json()
|
||||
else:
|
||||
return json.dumps(self.actual_instance)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
"""Returns the dict representation of the actual instance"""
|
||||
if self.actual_instance is None:
|
||||
return "null"
|
||||
|
||||
to_json = getattr(self.actual_instance, "to_json", None)
|
||||
if callable(to_json):
|
||||
return self.actual_instance.to_dict()
|
||||
else:
|
||||
return json.dumps(self.actual_instance)
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the actual instance"""
|
||||
return pprint.pformat(self.dict())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user