Skip to content

Commit f3adf36

Browse files
7ac70782b7217dc5a6e2a4112750329ecb74eb44
1 parent 1e527c6 commit f3adf36

9 files changed

Lines changed: 251 additions & 53 deletions

.openapi-generator/FILES

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ docs/StudysetList.md
102102
docs/StudysetRequest.md
103103
docs/StudysetRequestRelationships.md
104104
docs/StudysetRequestRelationshipsStudiesInner.md
105-
docs/StudysetRequestRelationshipsStudiesInnerOneOf.md
105+
docs/StudysetRequestRelationshipsStudiesInnerAnyOf.md
106106
docs/StudysetReturn.md
107107
docs/StudysetReturnRelationships.md
108108
docs/StudysetReturnRelationshipsStudies.md
@@ -228,7 +228,7 @@ neurostore_sdk/models/studyset_list.py
228228
neurostore_sdk/models/studyset_request.py
229229
neurostore_sdk/models/studyset_request_relationships.py
230230
neurostore_sdk/models/studyset_request_relationships_studies_inner.py
231-
neurostore_sdk/models/studyset_request_relationships_studies_inner_one_of.py
231+
neurostore_sdk/models/studyset_request_relationships_studies_inner_any_of.py
232232
neurostore_sdk/models/studyset_return.py
233233
neurostore_sdk/models/studyset_return_relationships.py
234234
neurostore_sdk/models/studyset_return_relationships_studies.py
@@ -249,4 +249,5 @@ setup.cfg
249249
setup.py
250250
test-requirements.txt
251251
test/__init__.py
252+
test/test_studyset_request_relationships_studies_inner_any_of.py
252253
tox.ini

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Class | Method | HTTP request | Description
306306
- [StudysetRequest](docs/StudysetRequest.md)
307307
- [StudysetRequestRelationships](docs/StudysetRequestRelationships.md)
308308
- [StudysetRequestRelationshipsStudiesInner](docs/StudysetRequestRelationshipsStudiesInner.md)
309-
- [StudysetRequestRelationshipsStudiesInnerOneOf](docs/StudysetRequestRelationshipsStudiesInnerOneOf.md)
309+
- [StudysetRequestRelationshipsStudiesInnerAnyOf](docs/StudysetRequestRelationshipsStudiesInnerAnyOf.md)
310310
- [StudysetReturn](docs/StudysetReturn.md)
311311
- [StudysetReturnRelationships](docs/StudysetReturnRelationships.md)
312312
- [StudysetReturnRelationshipsStudies](docs/StudysetReturnRelationshipsStudies.md)

docs/StudysetRequestRelationshipsStudiesInner.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@
55

66
Name | Type | Description | Notes
77
------------ | ------------- | ------------- | -------------
8-
**id** | **str** | |
8+
**id** | **str** | short UUID specifying the location of this resource |
99
**curation_stub_uuid** | **str** | | [optional]
10+
**doi** | **str** | Digital object identifier of the study. | [optional]
11+
**name** | **str** | Title of the study. | [optional]
12+
**metadata** | **object** | Metadata associated with the study not covered by the other study attributes. | [optional]
13+
**description** | **str** | Long form description of the study, typically the abstract. | [optional]
14+
**publication** | **str** | The journal/place of publication for the study. | [optional]
15+
**pmid** | **str** | If the study was published on PubMed, place the PubMed ID here. | [optional]
16+
**authors** | **str** | The authors on the publication of this study. | [optional]
17+
**year** | **int** | The year this study was published. | [optional]
18+
**analyses** | [**StudyRequestRelationshipsAnalyses**](StudyRequestRelationshipsAnalyses.md) | | [optional]
19+
**public** | **bool** | whether the resource is listed in public searches or not | [optional] [default to True]
20+
**pmcid** | **str** | | [optional]
1021

1122
## Example
1223

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# StudysetRequestRelationshipsStudiesInnerAnyOf
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**id** | **str** | |
9+
**curation_stub_uuid** | **str** | | [optional]
10+
11+
## Example
12+
13+
```python
14+
from neurostore_sdk.models.studyset_request_relationships_studies_inner_any_of import StudysetRequestRelationshipsStudiesInnerAnyOf
15+
16+
# TODO update the JSON string below
17+
json = "{}"
18+
# create an instance of StudysetRequestRelationshipsStudiesInnerAnyOf from a JSON string
19+
studyset_request_relationships_studies_inner_any_of_instance = StudysetRequestRelationshipsStudiesInnerAnyOf.from_json(json)
20+
# print the JSON string representation of the object
21+
print(StudysetRequestRelationshipsStudiesInnerAnyOf.to_json())
22+
23+
# convert the object into a dict
24+
studyset_request_relationships_studies_inner_any_of_dict = studyset_request_relationships_studies_inner_any_of_instance.to_dict()
25+
# create an instance of StudysetRequestRelationshipsStudiesInnerAnyOf from a dict
26+
studyset_request_relationships_studies_inner_any_of_from_dict = StudysetRequestRelationshipsStudiesInnerAnyOf.from_dict(studyset_request_relationships_studies_inner_any_of_dict)
27+
```
28+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
29+
30+

neurostore_sdk/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"StudysetRequest",
131131
"StudysetRequestRelationships",
132132
"StudysetRequestRelationshipsStudiesInner",
133-
"StudysetRequestRelationshipsStudiesInnerOneOf",
133+
"StudysetRequestRelationshipsStudiesInnerAnyOf",
134134
"StudysetReturn",
135135
"StudysetReturnRelationships",
136136
"StudysetReturnRelationshipsStudies",
@@ -261,7 +261,7 @@
261261
from neurostore_sdk.models.studyset_request import StudysetRequest as StudysetRequest
262262
from neurostore_sdk.models.studyset_request_relationships import StudysetRequestRelationships as StudysetRequestRelationships
263263
from neurostore_sdk.models.studyset_request_relationships_studies_inner import StudysetRequestRelationshipsStudiesInner as StudysetRequestRelationshipsStudiesInner
264-
from neurostore_sdk.models.studyset_request_relationships_studies_inner_one_of import StudysetRequestRelationshipsStudiesInnerOneOf as StudysetRequestRelationshipsStudiesInnerOneOf
264+
from neurostore_sdk.models.studyset_request_relationships_studies_inner_any_of import StudysetRequestRelationshipsStudiesInnerAnyOf as StudysetRequestRelationshipsStudiesInnerAnyOf
265265
from neurostore_sdk.models.studyset_return import StudysetReturn as StudysetReturn
266266
from neurostore_sdk.models.studyset_return_relationships import StudysetReturnRelationships as StudysetReturnRelationships
267267
from neurostore_sdk.models.studyset_return_relationships_studies import StudysetReturnRelationshipsStudies as StudysetReturnRelationshipsStudies

neurostore_sdk/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
from neurostore_sdk.models.studyset_request import StudysetRequest
103103
from neurostore_sdk.models.studyset_request_relationships import StudysetRequestRelationships
104104
from neurostore_sdk.models.studyset_request_relationships_studies_inner import StudysetRequestRelationshipsStudiesInner
105-
from neurostore_sdk.models.studyset_request_relationships_studies_inner_one_of import StudysetRequestRelationshipsStudiesInnerOneOf
105+
from neurostore_sdk.models.studyset_request_relationships_studies_inner_any_of import StudysetRequestRelationshipsStudiesInnerAnyOf
106106
from neurostore_sdk.models.studyset_return import StudysetReturn
107107
from neurostore_sdk.models.studyset_return_relationships import StudysetReturnRelationships
108108
from neurostore_sdk.models.studyset_return_relationships_studies import StudysetReturnRelationshipsStudies

neurostore_sdk/models/studyset_request_relationships_studies_inner.py

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,41 @@
1414

1515

1616
from __future__ import annotations
17+
from inspect import getfullargspec
1718
import json
1819
import pprint
20+
import re # noqa: F401
1921
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20-
from typing import Any, List, Optional
21-
from neurostore_sdk.models.studyset_request_relationships_studies_inner_one_of import StudysetRequestRelationshipsStudiesInnerOneOf
22-
from pydantic import StrictStr, Field
23-
from typing import Union, List, Set, Optional, Dict
22+
from typing import Optional
23+
from neurostore_sdk.models.study_request import StudyRequest
24+
from neurostore_sdk.models.studyset_request_relationships_studies_inner_any_of import StudysetRequestRelationshipsStudiesInnerAnyOf
25+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
2426
from typing_extensions import Literal, Self
27+
from pydantic import Field
2528

26-
STUDYSETREQUESTRELATIONSHIPSSTUDIESINNER_ONE_OF_SCHEMAS = ["StudysetRequestRelationshipsStudiesInnerOneOf", "str"]
29+
STUDYSETREQUESTRELATIONSHIPSSTUDIESINNER_ANY_OF_SCHEMAS = ["StudyRequest", "StudysetRequestRelationshipsStudiesInnerAnyOf", "str"]
2730

2831
class StudysetRequestRelationshipsStudiesInner(BaseModel):
2932
"""
3033
StudysetRequestRelationshipsStudiesInner
3134
"""
32-
# data type: str
33-
oneof_schema_1_validator: Optional[StrictStr] = None
34-
# data type: StudysetRequestRelationshipsStudiesInnerOneOf
35-
oneof_schema_2_validator: Optional[StudysetRequestRelationshipsStudiesInnerOneOf] = None
36-
actual_instance: Optional[Union[StudysetRequestRelationshipsStudiesInnerOneOf, str]] = None
37-
one_of_schemas: Set[str] = { "StudysetRequestRelationshipsStudiesInnerOneOf", "str" }
38-
39-
model_config = ConfigDict(
40-
validate_assignment=True,
41-
protected_namespaces=(),
42-
)
4335

36+
# data type: str
37+
anyof_schema_1_validator: Optional[StrictStr] = None
38+
# data type: StudysetRequestRelationshipsStudiesInnerAnyOf
39+
anyof_schema_2_validator: Optional[StudysetRequestRelationshipsStudiesInnerAnyOf] = None
40+
# data type: StudyRequest
41+
anyof_schema_3_validator: Optional[StudyRequest] = None
42+
if TYPE_CHECKING:
43+
actual_instance: Optional[Union[StudyRequest, StudysetRequestRelationshipsStudiesInnerAnyOf, str]] = None
44+
else:
45+
actual_instance: Any = None
46+
any_of_schemas: Set[str] = { "StudyRequest", "StudysetRequestRelationshipsStudiesInnerAnyOf", "str" }
47+
48+
model_config = {
49+
"validate_assignment": True,
50+
"protected_namespaces": (),
51+
}
4452

4553
def __init__(self, *args, **kwargs) -> None:
4654
if args:
@@ -53,63 +61,67 @@ def __init__(self, *args, **kwargs) -> None:
5361
super().__init__(**kwargs)
5462

5563
@field_validator('actual_instance')
56-
def actual_instance_must_validate_oneof(cls, v):
64+
def actual_instance_must_validate_anyof(cls, v):
5765
instance = StudysetRequestRelationshipsStudiesInner.model_construct()
5866
error_messages = []
59-
match = 0
6067
# validate data type: str
6168
try:
62-
instance.oneof_schema_1_validator = v
63-
match += 1
69+
instance.anyof_schema_1_validator = v
70+
return v
6471
except (ValidationError, ValueError) as e:
6572
error_messages.append(str(e))
66-
# validate data type: StudysetRequestRelationshipsStudiesInnerOneOf
67-
if not isinstance(v, StudysetRequestRelationshipsStudiesInnerOneOf):
68-
error_messages.append(f"Error! Input type `{type(v)}` is not `StudysetRequestRelationshipsStudiesInnerOneOf`")
73+
# validate data type: StudysetRequestRelationshipsStudiesInnerAnyOf
74+
if not isinstance(v, StudysetRequestRelationshipsStudiesInnerAnyOf):
75+
error_messages.append(f"Error! Input type `{type(v)}` is not `StudysetRequestRelationshipsStudiesInnerAnyOf`")
6976
else:
70-
match += 1
71-
if match > 1:
72-
# more than 1 match
73-
raise ValueError("Multiple matches found when setting `actual_instance` in StudysetRequestRelationshipsStudiesInner with oneOf schemas: StudysetRequestRelationshipsStudiesInnerOneOf, str. Details: " + ", ".join(error_messages))
74-
elif match == 0:
77+
return v
78+
79+
# validate data type: StudyRequest
80+
if not isinstance(v, StudyRequest):
81+
error_messages.append(f"Error! Input type `{type(v)}` is not `StudyRequest`")
82+
else:
83+
return v
84+
85+
if error_messages:
7586
# no match
76-
raise ValueError("No match found when setting `actual_instance` in StudysetRequestRelationshipsStudiesInner with oneOf schemas: StudysetRequestRelationshipsStudiesInnerOneOf, str. Details: " + ", ".join(error_messages))
87+
raise ValueError("No match found when setting the actual_instance in StudysetRequestRelationshipsStudiesInner with anyOf schemas: StudyRequest, StudysetRequestRelationshipsStudiesInnerAnyOf, str. Details: " + ", ".join(error_messages))
7788
else:
7889
return v
7990

8091
@classmethod
81-
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
92+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
8293
return cls.from_json(json.dumps(obj))
8394

8495
@classmethod
8596
def from_json(cls, json_str: str) -> Self:
8697
"""Returns the object represented by the json string"""
8798
instance = cls.model_construct()
8899
error_messages = []
89-
match = 0
90-
91100
# deserialize data into str
92101
try:
93102
# validation
94-
instance.oneof_schema_1_validator = json.loads(json_str)
103+
instance.anyof_schema_1_validator = json.loads(json_str)
95104
# assign value to actual_instance
96-
instance.actual_instance = instance.oneof_schema_1_validator
97-
match += 1
105+
instance.actual_instance = instance.anyof_schema_1_validator
106+
return instance
98107
except (ValidationError, ValueError) as e:
99108
error_messages.append(str(e))
100-
# deserialize data into StudysetRequestRelationshipsStudiesInnerOneOf
109+
# anyof_schema_2_validator: Optional[StudysetRequestRelationshipsStudiesInnerAnyOf] = None
110+
try:
111+
instance.actual_instance = StudysetRequestRelationshipsStudiesInnerAnyOf.from_json(json_str)
112+
return instance
113+
except (ValidationError, ValueError) as e:
114+
error_messages.append(str(e))
115+
# anyof_schema_3_validator: Optional[StudyRequest] = None
101116
try:
102-
instance.actual_instance = StudysetRequestRelationshipsStudiesInnerOneOf.from_json(json_str)
103-
match += 1
117+
instance.actual_instance = StudyRequest.from_json(json_str)
118+
return instance
104119
except (ValidationError, ValueError) as e:
105-
error_messages.append(str(e))
120+
error_messages.append(str(e))
106121

107-
if match > 1:
108-
# more than 1 match
109-
raise ValueError("Multiple matches found when deserializing the JSON string into StudysetRequestRelationshipsStudiesInner with oneOf schemas: StudysetRequestRelationshipsStudiesInnerOneOf, str. Details: " + ", ".join(error_messages))
110-
elif match == 0:
122+
if error_messages:
111123
# no match
112-
raise ValueError("No match found when deserializing the JSON string into StudysetRequestRelationshipsStudiesInner with oneOf schemas: StudysetRequestRelationshipsStudiesInnerOneOf, str. Details: " + ", ".join(error_messages))
124+
raise ValueError("No match found when deserializing the JSON string into StudysetRequestRelationshipsStudiesInner with anyOf schemas: StudyRequest, StudysetRequestRelationshipsStudiesInnerAnyOf, str. Details: " + ", ".join(error_messages))
113125
else:
114126
return instance
115127

@@ -123,15 +135,14 @@ def to_json(self) -> str:
123135
else:
124136
return json.dumps(self.actual_instance)
125137

126-
def to_dict(self) -> Optional[Union[Dict[str, Any], StudysetRequestRelationshipsStudiesInnerOneOf, str]]:
138+
def to_dict(self) -> Optional[Union[Dict[str, Any], StudyRequest, StudysetRequestRelationshipsStudiesInnerAnyOf, str]]:
127139
"""Returns the dict representation of the actual instance"""
128140
if self.actual_instance is None:
129141
return None
130142

131143
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
132144
return self.actual_instance.to_dict()
133145
else:
134-
# primitive type
135146
return self.actual_instance
136147

137148
def to_str(self) -> str:
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# coding: utf-8
2+
3+
"""
4+
neurostore api
5+
6+
Create studysets for meta-analysis
7+
8+
The version of the OpenAPI document: 1.0
9+
Contact: jamesdkent21@gmail.com
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+
from pydantic import BaseModel, ConfigDict, StrictStr
22+
from typing import Any, ClassVar, Dict, List, Optional
23+
from uuid import UUID
24+
from typing import Optional, Set
25+
from typing_extensions import Self
26+
27+
class StudysetRequestRelationshipsStudiesInnerAnyOf(BaseModel):
28+
"""
29+
StudysetRequestRelationshipsStudiesInnerAnyOf
30+
""" # noqa: E501
31+
id: StrictStr
32+
curation_stub_uuid: Optional[UUID] = None
33+
__properties: ClassVar[List[str]] = ["id", "curation_stub_uuid"]
34+
35+
model_config = ConfigDict(
36+
populate_by_name=True,
37+
validate_assignment=True,
38+
protected_namespaces=(),
39+
)
40+
41+
42+
def to_str(self) -> str:
43+
"""Returns the string representation of the model using alias"""
44+
return pprint.pformat(self.model_dump(by_alias=True))
45+
46+
def to_json(self) -> str:
47+
"""Returns the JSON representation of the model using alias"""
48+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49+
return json.dumps(self.to_dict())
50+
51+
@classmethod
52+
def from_json(cls, json_str: str) -> Optional[Self]:
53+
"""Create an instance of StudysetRequestRelationshipsStudiesInnerAnyOf from a JSON string"""
54+
return cls.from_dict(json.loads(json_str))
55+
56+
def to_dict(self) -> Dict[str, Any]:
57+
"""Return the dictionary representation of the model using alias.
58+
59+
This has the following differences from calling pydantic's
60+
`self.model_dump(by_alias=True)`:
61+
62+
* `None` is only added to the output dict for nullable fields that
63+
were set at model initialization. Other fields with value `None`
64+
are ignored.
65+
"""
66+
excluded_fields: Set[str] = set([
67+
])
68+
69+
_dict = self.model_dump(
70+
by_alias=True,
71+
exclude=excluded_fields,
72+
exclude_none=True,
73+
)
74+
return _dict
75+
76+
@classmethod
77+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78+
"""Create an instance of StudysetRequestRelationshipsStudiesInnerAnyOf from a dict"""
79+
if obj is None:
80+
return None
81+
82+
if not isinstance(obj, dict):
83+
return cls.model_validate(obj)
84+
85+
_obj = cls.model_validate({
86+
"id": obj.get("id"),
87+
"curation_stub_uuid": obj.get("curation_stub_uuid")
88+
})
89+
return _obj
90+
91+

0 commit comments

Comments
 (0)