Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .generation/input/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6059,7 +6059,7 @@
],
"properties": {
"id": {
"$ref": "#/components/schemas/DatasetId"
"$ref": "#/components/schemas/DatasetName"
},
"type": {
"type": "string",
Expand Down Expand Up @@ -7046,6 +7046,25 @@
"MlModelName": {
"type": "string"
},
"MlModelResource": {
"type": "object",
"title": "MlModelResource",
"required": [
"type",
"id"
],
"properties": {
"id": {
"$ref": "#/components/schemas/MlModelName"
},
"type": {
"type": "string",
"enum": [
"mlModel"
]
}
}
},
"MockDatasetDataSourceLoadingInfo": {
"type": "object",
"required": [
Expand Down Expand Up @@ -8496,6 +8515,9 @@
},
{
"$ref": "#/components/schemas/DatasetResource"
},
{
"$ref": "#/components/schemas/MlModelResource"
}
],
"discriminator": {
Expand All @@ -8504,6 +8526,7 @@
"dataset": "#/components/schemas/DatasetResource",
"layer": "#/components/schemas/LayerResource",
"layerCollection": "#/components/schemas/LayerCollectionResource",
"mlModel": "#/components/schemas/MlModelResource",
"project": "#/components/schemas/ProjectResource"
}
}
Expand Down
3 changes: 3 additions & 0 deletions python/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ docs/MetaDataDefinition.md
docs/MetaDataSuggestion.md
docs/MlModel.md
docs/MlModelMetadata.md
docs/MlModelResource.md
docs/MockDatasetDataSourceLoadingInfo.md
docs/MockMetaData.md
docs/MultiBandRasterColorizer.md
Expand Down Expand Up @@ -345,6 +346,7 @@ geoengine_openapi_client/models/meta_data_definition.py
geoengine_openapi_client/models/meta_data_suggestion.py
geoengine_openapi_client/models/ml_model.py
geoengine_openapi_client/models/ml_model_metadata.py
geoengine_openapi_client/models/ml_model_resource.py
geoengine_openapi_client/models/mock_dataset_data_source_loading_info.py
geoengine_openapi_client/models/mock_meta_data.py
geoengine_openapi_client/models/multi_band_raster_colorizer.py
Expand Down Expand Up @@ -580,6 +582,7 @@ test/test_meta_data_suggestion.py
test/test_ml_api.py
test/test_ml_model.py
test/test_ml_model_metadata.py
test/test_ml_model_resource.py
test/test_mock_dataset_data_source_loading_info.py
test/test_mock_meta_data.py
test/test_multi_band_raster_colorizer.py
Expand Down
1 change: 1 addition & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ Class | Method | HTTP request | Description
- [MetaDataSuggestion](docs/MetaDataSuggestion.md)
- [MlModel](docs/MlModel.md)
- [MlModelMetadata](docs/MlModelMetadata.md)
- [MlModelResource](docs/MlModelResource.md)
- [MockDatasetDataSourceLoadingInfo](docs/MockDatasetDataSourceLoadingInfo.md)
- [MockMetaData](docs/MockMetaData.md)
- [MultiBandRasterColorizer](docs/MultiBandRasterColorizer.md)
Expand Down
1 change: 1 addition & 0 deletions python/geoengine_openapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
from geoengine_openapi_client.models.meta_data_suggestion import MetaDataSuggestion
from geoengine_openapi_client.models.ml_model import MlModel
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer
Expand Down
1 change: 1 addition & 0 deletions python/geoengine_openapi_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
from geoengine_openapi_client.models.meta_data_suggestion import MetaDataSuggestion
from geoengine_openapi_client.models.ml_model import MlModel
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer
Expand Down
4 changes: 2 additions & 2 deletions python/geoengine_openapi_client/models/layer_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class LayerResource(BaseModel):
@validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value not in ('layer', 'layerCollection', 'project', 'dataset'):
raise ValueError("must be one of enum values ('layer', 'layerCollection', 'project', 'dataset')")
if value not in ('layer', 'layerCollection', 'project', 'dataset', 'mlModel'):
raise ValueError("must be one of enum values ('layer', 'layerCollection', 'project', 'dataset', 'mlModel')")
return value

class Config:
Expand Down
81 changes: 81 additions & 0 deletions python/geoengine_openapi_client/models/ml_model_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# coding: utf-8

"""
Geo Engine API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 0.8.0
Contact: [email protected]
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, validator

class MlModelResource(BaseModel):
"""
MlModelResource
"""
id: StrictStr = Field(...)
type: StrictStr = Field(...)
__properties = ["id", "type"]

@validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value not in ('mlModel'):
raise ValueError("must be one of enum values ('mlModel')")
return value

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) -> MlModelResource:
"""Create an instance of MlModelResource 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) -> MlModelResource:
"""Create an instance of MlModelResource from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return MlModelResource.parse_obj(obj)

_obj = MlModelResource.parse_obj({
"id": obj.get("id"),
"type": obj.get("type")
})
return _obj


36 changes: 30 additions & 6 deletions python/geoengine_openapi_client/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
from geoengine_openapi_client.models.dataset_resource import DatasetResource
from geoengine_openapi_client.models.layer_collection_resource import LayerCollectionResource
from geoengine_openapi_client.models.layer_resource import LayerResource
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
from geoengine_openapi_client.models.project_resource import ProjectResource
from typing import Union, Any, List, TYPE_CHECKING
from pydantic import StrictStr, Field

RESOURCE_ONE_OF_SCHEMAS = ["DatasetResource", "LayerCollectionResource", "LayerResource", "ProjectResource"]
RESOURCE_ONE_OF_SCHEMAS = ["DatasetResource", "LayerCollectionResource", "LayerResource", "MlModelResource", "ProjectResource"]

class Resource(BaseModel):
"""
Expand All @@ -42,8 +43,10 @@ class Resource(BaseModel):
oneof_schema_3_validator: Optional[ProjectResource] = None
# data type: DatasetResource
oneof_schema_4_validator: Optional[DatasetResource] = None
# data type: MlModelResource
oneof_schema_5_validator: Optional[MlModelResource] = None
if TYPE_CHECKING:
actual_instance: Union[DatasetResource, LayerCollectionResource, LayerResource, ProjectResource]
actual_instance: Union[DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource]
else:
actual_instance: Any
one_of_schemas: List[str] = Field(RESOURCE_ONE_OF_SCHEMAS, const=True)
Expand Down Expand Up @@ -89,12 +92,17 @@ def actual_instance_must_validate_oneof(cls, v):
error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetResource`")
else:
match += 1
# validate data type: MlModelResource
if not isinstance(v, MlModelResource):
error_messages.append(f"Error! Input type `{type(v)}` is not `MlModelResource`")
else:
match += 1
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
raise ValueError("Multiple matches found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
raise ValueError("No match found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
else:
return v

Expand Down Expand Up @@ -129,6 +137,11 @@ def from_json(cls, json_str: str) -> Resource:
instance.actual_instance = LayerResource.from_json(json_str)
return instance

# check if data type is `MlModelResource`
if _data_type == "MlModelResource":
instance.actual_instance = MlModelResource.from_json(json_str)
return instance

# check if data type is `ProjectResource`
if _data_type == "ProjectResource":
instance.actual_instance = ProjectResource.from_json(json_str)
Expand All @@ -149,6 +162,11 @@ def from_json(cls, json_str: str) -> Resource:
instance.actual_instance = LayerCollectionResource.from_json(json_str)
return instance

# check if data type is `MlModelResource`
if _data_type == "mlModel":
instance.actual_instance = MlModelResource.from_json(json_str)
return instance

# check if data type is `ProjectResource`
if _data_type == "project":
instance.actual_instance = ProjectResource.from_json(json_str)
Expand Down Expand Up @@ -178,13 +196,19 @@ def from_json(cls, json_str: str) -> Resource:
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into MlModelResource
try:
instance.actual_instance = MlModelResource.from_json(json_str)
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
raise ValueError("Multiple matches found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
raise ValueError("No match found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
else:
return instance

Expand Down
56 changes: 56 additions & 0 deletions python/test/test_ml_model_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# coding: utf-8

"""
Geo Engine API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 0.8.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


import unittest
import datetime

from geoengine_openapi_client.models.ml_model_resource import MlModelResource # noqa: E501

class TestMlModelResource(unittest.TestCase):
"""MlModelResource unit test stubs"""

def setUp(self):
pass

def tearDown(self):
pass

def make_instance(self, include_optional) -> MlModelResource:
"""Test MlModelResource
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 `MlModelResource`
"""
model = MlModelResource() # noqa: E501
if include_optional:
return MlModelResource(
id = '',
type = 'mlModel'
)
else:
return MlModelResource(
id = '',
type = 'mlModel',
)
"""

def testMlModelResource(self):
"""Test MlModelResource"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

if __name__ == '__main__':
unittest.main()
44 changes: 44 additions & 0 deletions typescript/dist/esm/models/MlModelResource.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Geo Engine API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.8.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface MlModelResource
*/
export interface MlModelResource {
/**
*
* @type {string}
* @memberof MlModelResource
*/
id: string;
/**
*
* @type {string}
* @memberof MlModelResource
*/
type: MlModelResourceTypeEnum;
}
/**
* @export
*/
export declare const MlModelResourceTypeEnum: {
readonly MlModel: "mlModel";
};
export type MlModelResourceTypeEnum = typeof MlModelResourceTypeEnum[keyof typeof MlModelResourceTypeEnum];
/**
* Check if a given object implements the MlModelResource interface.
*/
export declare function instanceOfMlModelResource(value: object): boolean;
export declare function MlModelResourceFromJSON(json: any): MlModelResource;
export declare function MlModelResourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): MlModelResource;
export declare function MlModelResourceToJSON(value?: MlModelResource | null): any;
Loading
Loading