-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
224 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ResourceType | ||
|
||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**resource_type** | **str** | | | ||
**resource_table** | **str** | | | ||
**select_columns** | **List[str]** | | | ||
**resource_url_template** | **str** | | | ||
**relationship_config** | [**List[RelationshipConfigItem]**](RelationshipConfigItem.md) | | | ||
|
||
## Example | ||
|
||
```python | ||
from onelens_backend_client.models.resource_type import ResourceType | ||
|
||
# TODO update the JSON string below | ||
json = "{}" | ||
# create an instance of ResourceType from a JSON string | ||
resource_type_instance = ResourceType.from_json(json) | ||
# print the JSON string representation of the object | ||
print(ResourceType.to_json()) | ||
|
||
# convert the object into a dict | ||
resource_type_dict = resource_type_instance.to_dict() | ||
# create an instance of ResourceType from a dict | ||
resource_type_form_dict = resource_type.from_dict(resource_type_dict) | ||
``` | ||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
onelens-backend | ||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
The version of the OpenAPI document: 1.0.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, ConfigDict, StrictStr | ||
from typing import Any, ClassVar, Dict, List | ||
from onelens_backend_client.models.relationship_config_item import RelationshipConfigItem | ||
from typing import Optional, Set | ||
from typing_extensions import Self | ||
|
||
class ResourceType(BaseModel): | ||
""" | ||
ResourceType | ||
""" # noqa: E501 | ||
resource_type: StrictStr | ||
resource_table: StrictStr | ||
select_columns: List[StrictStr] | ||
resource_url_template: StrictStr | ||
relationship_config: List[RelationshipConfigItem] | ||
__properties: ClassVar[List[str]] = ["resource_type", "resource_table", "select_columns", "resource_url_template", "relationship_config"] | ||
|
||
model_config = ConfigDict( | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
) | ||
|
||
|
||
def to_str(self) -> str: | ||
"""Returns the string representation of the model using alias""" | ||
return pprint.pformat(self.model_dump(by_alias=True)) | ||
|
||
def to_json(self) -> str: | ||
"""Returns the JSON representation of the model using alias""" | ||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead | ||
return json.dumps(self.to_dict()) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of ResourceType from a JSON string""" | ||
return cls.from_dict(json.loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias. | ||
This has the following differences from calling pydantic's | ||
`self.model_dump(by_alias=True)`: | ||
* `None` is only added to the output dict for nullable fields that | ||
were set at model initialization. Other fields with value `None` | ||
are ignored. | ||
""" | ||
excluded_fields: Set[str] = set([ | ||
]) | ||
|
||
_dict = self.model_dump( | ||
by_alias=True, | ||
exclude=excluded_fields, | ||
exclude_none=True, | ||
) | ||
# override the default output from pydantic by calling `to_dict()` of each item in relationship_config (list) | ||
_items = [] | ||
if self.relationship_config: | ||
for _item in self.relationship_config: | ||
if _item: | ||
_items.append(_item.to_dict()) | ||
_dict['relationship_config'] = _items | ||
return _dict | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of ResourceType from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate({ | ||
"resource_type": obj.get("resource_type"), | ||
"resource_table": obj.get("resource_table"), | ||
"select_columns": obj.get("select_columns"), | ||
"resource_url_template": obj.get("resource_url_template"), | ||
"relationship_config": [RelationshipConfigItem.from_dict(_item) for _item in obj["relationship_config"]] if obj.get("relationship_config") is not None else None | ||
}) | ||
return _obj | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
onelens-backend | ||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
The version of the OpenAPI document: 1.0.0 | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
Do not edit the class manually. | ||
""" # noqa: E501 | ||
|
||
|
||
import unittest | ||
|
||
from onelens_backend_client.models.resource_type import ResourceType | ||
|
||
class TestResourceType(unittest.TestCase): | ||
"""ResourceType unit test stubs""" | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def make_instance(self, include_optional) -> ResourceType: | ||
"""Test ResourceType | ||
include_option is a boolean, when False only required | ||
params are included, when True both required and | ||
optional params are included """ | ||
# uncomment below to create an instance of `ResourceType` | ||
""" | ||
model = ResourceType() | ||
if include_optional: | ||
return ResourceType( | ||
resource_type = '', | ||
resource_table = '', | ||
select_columns = [ | ||
'' | ||
], | ||
resource_url_template = '', | ||
relationship_config = [ | ||
onelens_backend_client.models.relationship_config_item.RelationshipConfigItem( | ||
relationship_type = '', | ||
join = onelens_backend_client.models.join.Join( | ||
current_table_column = '', | ||
join_table = '', | ||
join_table_column = '', ), ) | ||
] | ||
) | ||
else: | ||
return ResourceType( | ||
resource_type = '', | ||
resource_table = '', | ||
select_columns = [ | ||
'' | ||
], | ||
resource_url_template = '', | ||
relationship_config = [ | ||
onelens_backend_client.models.relationship_config_item.RelationshipConfigItem( | ||
relationship_type = '', | ||
join = onelens_backend_client.models.join.Join( | ||
current_table_column = '', | ||
join_table = '', | ||
join_table_column = '', ), ) | ||
], | ||
) | ||
""" | ||
|
||
def testResourceType(self): | ||
"""Test ResourceType""" | ||
# inst_req_only = self.make_instance(include_optional=False) | ||
# inst_req_and_optional = self.make_instance(include_optional=True) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |