Skip to content

Commit 39f5e2f

Browse files
committed
update openapi-client
1 parent 36fd39f commit 39f5e2f

File tree

24 files changed

+516
-10
lines changed

24 files changed

+516
-10
lines changed

.generation/input/openapi.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6059,7 +6059,7 @@
60596059
],
60606060
"properties": {
60616061
"id": {
6062-
"$ref": "#/components/schemas/DatasetId"
6062+
"$ref": "#/components/schemas/DatasetName"
60636063
},
60646064
"type": {
60656065
"type": "string",
@@ -7046,6 +7046,25 @@
70467046
"MlModelName": {
70477047
"type": "string"
70487048
},
7049+
"MlModelResource": {
7050+
"type": "object",
7051+
"title": "MlModelResource",
7052+
"required": [
7053+
"type",
7054+
"id"
7055+
],
7056+
"properties": {
7057+
"id": {
7058+
"$ref": "#/components/schemas/MlModelName"
7059+
},
7060+
"type": {
7061+
"type": "string",
7062+
"enum": [
7063+
"mlModel"
7064+
]
7065+
}
7066+
}
7067+
},
70497068
"MockDatasetDataSourceLoadingInfo": {
70507069
"type": "object",
70517070
"required": [
@@ -8496,6 +8515,9 @@
84968515
},
84978516
{
84988517
"$ref": "#/components/schemas/DatasetResource"
8518+
},
8519+
{
8520+
"$ref": "#/components/schemas/MlModelResource"
84998521
}
85008522
],
85018523
"discriminator": {
@@ -8504,6 +8526,7 @@
85048526
"dataset": "#/components/schemas/DatasetResource",
85058527
"layer": "#/components/schemas/LayerResource",
85068528
"layerCollection": "#/components/schemas/LayerCollectionResource",
8529+
"mlModel": "#/components/schemas/MlModelResource",
85078530
"project": "#/components/schemas/ProjectResource"
85088531
}
85098532
}

python/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ docs/MetaDataDefinition.md
8888
docs/MetaDataSuggestion.md
8989
docs/MlModel.md
9090
docs/MlModelMetadata.md
91+
docs/MlModelResource.md
9192
docs/MockDatasetDataSourceLoadingInfo.md
9293
docs/MockMetaData.md
9394
docs/MultiBandRasterColorizer.md
@@ -345,6 +346,7 @@ geoengine_openapi_client/models/meta_data_definition.py
345346
geoengine_openapi_client/models/meta_data_suggestion.py
346347
geoengine_openapi_client/models/ml_model.py
347348
geoengine_openapi_client/models/ml_model_metadata.py
349+
geoengine_openapi_client/models/ml_model_resource.py
348350
geoengine_openapi_client/models/mock_dataset_data_source_loading_info.py
349351
geoengine_openapi_client/models/mock_meta_data.py
350352
geoengine_openapi_client/models/multi_band_raster_colorizer.py
@@ -580,6 +582,7 @@ test/test_meta_data_suggestion.py
580582
test/test_ml_api.py
581583
test/test_ml_model.py
582584
test/test_ml_model_metadata.py
585+
test/test_ml_model_resource.py
583586
test/test_mock_dataset_data_source_loading_info.py
584587
test/test_mock_meta_data.py
585588
test/test_multi_band_raster_colorizer.py

python/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ Class | Method | HTTP request | Description
268268
- [MetaDataSuggestion](docs/MetaDataSuggestion.md)
269269
- [MlModel](docs/MlModel.md)
270270
- [MlModelMetadata](docs/MlModelMetadata.md)
271+
- [MlModelResource](docs/MlModelResource.md)
271272
- [MockDatasetDataSourceLoadingInfo](docs/MockDatasetDataSourceLoadingInfo.md)
272273
- [MockMetaData](docs/MockMetaData.md)
273274
- [MultiBandRasterColorizer](docs/MultiBandRasterColorizer.md)

python/geoengine_openapi_client/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
from geoengine_openapi_client.models.meta_data_suggestion import MetaDataSuggestion
129129
from geoengine_openapi_client.models.ml_model import MlModel
130130
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
131+
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
131132
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
132133
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
133134
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer

python/geoengine_openapi_client/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
from geoengine_openapi_client.models.meta_data_suggestion import MetaDataSuggestion
9797
from geoengine_openapi_client.models.ml_model import MlModel
9898
from geoengine_openapi_client.models.ml_model_metadata import MlModelMetadata
99+
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
99100
from geoengine_openapi_client.models.mock_dataset_data_source_loading_info import MockDatasetDataSourceLoadingInfo
100101
from geoengine_openapi_client.models.mock_meta_data import MockMetaData
101102
from geoengine_openapi_client.models.multi_band_raster_colorizer import MultiBandRasterColorizer

python/geoengine_openapi_client/models/layer_resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class LayerResource(BaseModel):
3333
@validator('type')
3434
def type_validate_enum(cls, value):
3535
"""Validates the enum"""
36-
if value not in ('layer', 'layerCollection', 'project', 'dataset'):
37-
raise ValueError("must be one of enum values ('layer', 'layerCollection', 'project', 'dataset')")
36+
if value not in ('layer', 'layerCollection', 'project', 'dataset', 'mlModel'):
37+
raise ValueError("must be one of enum values ('layer', 'layerCollection', 'project', 'dataset', 'mlModel')")
3838
return value
3939

4040
class Config:
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# coding: utf-8
2+
3+
"""
4+
Geo Engine API
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7+
8+
The version of the OpenAPI document: 0.8.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
from __future__ import annotations
17+
import pprint
18+
import re # noqa: F401
19+
import json
20+
21+
22+
23+
from pydantic import BaseModel, Field, StrictStr, validator
24+
25+
class MlModelResource(BaseModel):
26+
"""
27+
MlModelResource
28+
"""
29+
id: StrictStr = Field(...)
30+
type: StrictStr = Field(...)
31+
__properties = ["id", "type"]
32+
33+
@validator('type')
34+
def type_validate_enum(cls, value):
35+
"""Validates the enum"""
36+
if value not in ('mlModel'):
37+
raise ValueError("must be one of enum values ('mlModel')")
38+
return value
39+
40+
class Config:
41+
"""Pydantic configuration"""
42+
allow_population_by_field_name = True
43+
validate_assignment = True
44+
45+
def to_str(self) -> str:
46+
"""Returns the string representation of the model using alias"""
47+
return pprint.pformat(self.dict(by_alias=True))
48+
49+
def to_json(self) -> str:
50+
"""Returns the JSON representation of the model using alias"""
51+
return json.dumps(self.to_dict())
52+
53+
@classmethod
54+
def from_json(cls, json_str: str) -> MlModelResource:
55+
"""Create an instance of MlModelResource from a JSON string"""
56+
return cls.from_dict(json.loads(json_str))
57+
58+
def to_dict(self):
59+
"""Returns the dictionary representation of the model using alias"""
60+
_dict = self.dict(by_alias=True,
61+
exclude={
62+
},
63+
exclude_none=True)
64+
return _dict
65+
66+
@classmethod
67+
def from_dict(cls, obj: dict) -> MlModelResource:
68+
"""Create an instance of MlModelResource from a dict"""
69+
if obj is None:
70+
return None
71+
72+
if not isinstance(obj, dict):
73+
return MlModelResource.parse_obj(obj)
74+
75+
_obj = MlModelResource.parse_obj({
76+
"id": obj.get("id"),
77+
"type": obj.get("type")
78+
})
79+
return _obj
80+
81+

python/geoengine_openapi_client/models/resource.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
from geoengine_openapi_client.models.dataset_resource import DatasetResource
2525
from geoengine_openapi_client.models.layer_collection_resource import LayerCollectionResource
2626
from geoengine_openapi_client.models.layer_resource import LayerResource
27+
from geoengine_openapi_client.models.ml_model_resource import MlModelResource
2728
from geoengine_openapi_client.models.project_resource import ProjectResource
2829
from typing import Union, Any, List, TYPE_CHECKING
2930
from pydantic import StrictStr, Field
3031

31-
RESOURCE_ONE_OF_SCHEMAS = ["DatasetResource", "LayerCollectionResource", "LayerResource", "ProjectResource"]
32+
RESOURCE_ONE_OF_SCHEMAS = ["DatasetResource", "LayerCollectionResource", "LayerResource", "MlModelResource", "ProjectResource"]
3233

3334
class Resource(BaseModel):
3435
"""
@@ -42,8 +43,10 @@ class Resource(BaseModel):
4243
oneof_schema_3_validator: Optional[ProjectResource] = None
4344
# data type: DatasetResource
4445
oneof_schema_4_validator: Optional[DatasetResource] = None
46+
# data type: MlModelResource
47+
oneof_schema_5_validator: Optional[MlModelResource] = None
4548
if TYPE_CHECKING:
46-
actual_instance: Union[DatasetResource, LayerCollectionResource, LayerResource, ProjectResource]
49+
actual_instance: Union[DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource]
4750
else:
4851
actual_instance: Any
4952
one_of_schemas: List[str] = Field(RESOURCE_ONE_OF_SCHEMAS, const=True)
@@ -89,12 +92,17 @@ def actual_instance_must_validate_oneof(cls, v):
8992
error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetResource`")
9093
else:
9194
match += 1
95+
# validate data type: MlModelResource
96+
if not isinstance(v, MlModelResource):
97+
error_messages.append(f"Error! Input type `{type(v)}` is not `MlModelResource`")
98+
else:
99+
match += 1
92100
if match > 1:
93101
# more than 1 match
94-
raise ValueError("Multiple matches found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
102+
raise ValueError("Multiple matches found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
95103
elif match == 0:
96104
# no match
97-
raise ValueError("No match found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
105+
raise ValueError("No match found when setting `actual_instance` in Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
98106
else:
99107
return v
100108

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

140+
# check if data type is `MlModelResource`
141+
if _data_type == "MlModelResource":
142+
instance.actual_instance = MlModelResource.from_json(json_str)
143+
return instance
144+
132145
# check if data type is `ProjectResource`
133146
if _data_type == "ProjectResource":
134147
instance.actual_instance = ProjectResource.from_json(json_str)
@@ -149,6 +162,11 @@ def from_json(cls, json_str: str) -> Resource:
149162
instance.actual_instance = LayerCollectionResource.from_json(json_str)
150163
return instance
151164

165+
# check if data type is `MlModelResource`
166+
if _data_type == "mlModel":
167+
instance.actual_instance = MlModelResource.from_json(json_str)
168+
return instance
169+
152170
# check if data type is `ProjectResource`
153171
if _data_type == "project":
154172
instance.actual_instance = ProjectResource.from_json(json_str)
@@ -178,13 +196,19 @@ def from_json(cls, json_str: str) -> Resource:
178196
match += 1
179197
except (ValidationError, ValueError) as e:
180198
error_messages.append(str(e))
199+
# deserialize data into MlModelResource
200+
try:
201+
instance.actual_instance = MlModelResource.from_json(json_str)
202+
match += 1
203+
except (ValidationError, ValueError) as e:
204+
error_messages.append(str(e))
181205

182206
if match > 1:
183207
# more than 1 match
184-
raise ValueError("Multiple matches found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
208+
raise ValueError("Multiple matches found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
185209
elif match == 0:
186210
# no match
187-
raise ValueError("No match found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, ProjectResource. Details: " + ", ".join(error_messages))
211+
raise ValueError("No match found when deserializing the JSON string into Resource with oneOf schemas: DatasetResource, LayerCollectionResource, LayerResource, MlModelResource, ProjectResource. Details: " + ", ".join(error_messages))
188212
else:
189213
return instance
190214

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding: utf-8
2+
3+
"""
4+
Geo Engine API
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7+
8+
The version of the OpenAPI document: 0.8.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
import datetime
18+
19+
from geoengine_openapi_client.models.ml_model_resource import MlModelResource # noqa: E501
20+
21+
class TestMlModelResource(unittest.TestCase):
22+
"""MlModelResource unit test stubs"""
23+
24+
def setUp(self):
25+
pass
26+
27+
def tearDown(self):
28+
pass
29+
30+
def make_instance(self, include_optional) -> MlModelResource:
31+
"""Test MlModelResource
32+
include_option is a boolean, when False only required
33+
params are included, when True both required and
34+
optional params are included """
35+
# uncomment below to create an instance of `MlModelResource`
36+
"""
37+
model = MlModelResource() # noqa: E501
38+
if include_optional:
39+
return MlModelResource(
40+
id = '',
41+
type = 'mlModel'
42+
)
43+
else:
44+
return MlModelResource(
45+
id = '',
46+
type = 'mlModel',
47+
)
48+
"""
49+
50+
def testMlModelResource(self):
51+
"""Test MlModelResource"""
52+
# inst_req_only = self.make_instance(include_optional=False)
53+
# inst_req_and_optional = self.make_instance(include_optional=True)
54+
55+
if __name__ == '__main__':
56+
unittest.main()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Geo Engine API
3+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
*
5+
* The version of the OpenAPI document: 0.8.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
/**
13+
*
14+
* @export
15+
* @interface MlModelResource
16+
*/
17+
export interface MlModelResource {
18+
/**
19+
*
20+
* @type {string}
21+
* @memberof MlModelResource
22+
*/
23+
id: string;
24+
/**
25+
*
26+
* @type {string}
27+
* @memberof MlModelResource
28+
*/
29+
type: MlModelResourceTypeEnum;
30+
}
31+
/**
32+
* @export
33+
*/
34+
export declare const MlModelResourceTypeEnum: {
35+
readonly MlModel: "mlModel";
36+
};
37+
export type MlModelResourceTypeEnum = typeof MlModelResourceTypeEnum[keyof typeof MlModelResourceTypeEnum];
38+
/**
39+
* Check if a given object implements the MlModelResource interface.
40+
*/
41+
export declare function instanceOfMlModelResource(value: object): boolean;
42+
export declare function MlModelResourceFromJSON(json: any): MlModelResource;
43+
export declare function MlModelResourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): MlModelResource;
44+
export declare function MlModelResourceToJSON(value?: MlModelResource | null): any;

0 commit comments

Comments
 (0)