Skip to content

Commit 5f00e31

Browse files
committed
Make IdentificationTask.result nullable
1 parent a635b08 commit 5f00e31

File tree

9 files changed

+15
-26
lines changed

9 files changed

+15
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Introducing API v1 for Mosquito Alert platform, a project desgined to facilitate
44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
55

66
- API version: v1
7-
- Package version: 0.1.20
7+
- Package version: 0.1.21
88
- Generator version: 7.13.0
99
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1010

mosquito_alert/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
""" # noqa: E501
1616

1717

18-
__version__ = "0.1.20"
18+
__version__ = "0.1.21"
1919

2020
# import apis into sdk package
2121
from mosquito_alert.api.auth_api import AuthApi

mosquito_alert/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = 'OpenAPI-Generator/0.1.20/python'
94+
self.user_agent = 'OpenAPI-Generator/0.1.21/python'
9595
self.client_side_validation = configuration.client_side_validation
9696

9797
def __enter__(self):

mosquito_alert/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def to_debug_report(self) -> str:
551551
"OS: {env}\n"\
552552
"Python Version: {pyversion}\n"\
553553
"Version of the API: v1\n"\
554-
"SDK Package Version: 0.1.20".\
554+
"SDK Package Version: 0.1.21".\
555555
format(env=sys.platform, pyversion=sys.version)
556556

557557
def get_host_settings(self) -> List[HostSetting]:

mosquito_alert/models/identification_task.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class IdentificationTask(BaseModel):
4343
public_note: Optional[StrictStr]
4444
num_annotations: Annotated[int, Field(strict=True, ge=0)]
4545
review: Optional[IdentificationTaskReview]
46-
result: IdentificationTaskResult
46+
result: Optional[IdentificationTaskResult]
4747
created_at: datetime
4848
updated_at: datetime
4949
__properties: ClassVar[List[str]] = ["observation", "public_photo", "assignments", "status", "is_flagged", "is_safe", "public_note", "num_annotations", "review", "result", "created_at", "updated_at"]
@@ -146,6 +146,11 @@ def to_dict(self) -> Dict[str, Any]:
146146
if self.review is None and "review" in self.model_fields_set:
147147
_dict['review'] = None
148148

149+
# set to None if result (nullable) is None
150+
# and model_fields_set contains the field
151+
if self.result is None and "result" in self.model_fields_set:
152+
_dict['result'] = None
153+
149154
return _dict
150155

151156
@classmethod

mosquito_alert/models/identification_task_result.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class IdentificationTaskResult(BaseModel):
2929
"""
3030
IdentificationTaskResult
3131
""" # noqa: E501
32-
source: Optional[StrictStr]
32+
source: StrictStr
3333
taxon: Optional[SimpleTaxon]
3434
is_high_confidence: StrictBool
3535
confidence: Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]
@@ -41,9 +41,6 @@ class IdentificationTaskResult(BaseModel):
4141
@field_validator('source')
4242
def source_validate_enum(cls, value):
4343
"""Validates the enum"""
44-
if value is None:
45-
return value
46-
4744
if value not in set(['expert', 'ai']):
4845
raise ValueError("must be one of enum values ('expert', 'ai')")
4946
return value
@@ -102,11 +99,6 @@ def to_dict(self) -> Dict[str, Any]:
10299
# override the default output from pydantic by calling `to_dict()` of taxon
103100
if self.taxon:
104101
_dict['taxon'] = self.taxon.to_dict()
105-
# set to None if source (nullable) is None
106-
# and model_fields_set contains the field
107-
if self.source is None and "source" in self.model_fields_set:
108-
_dict['source'] = None
109-
110102
# set to None if taxon (nullable) is None
111103
# and model_fields_set contains the field
112104
if self.taxon is None and "taxon" in self.model_fields_set:

mosquito_alert/models/identification_task_result_request.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,20 @@
1919
import json
2020

2121
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22-
from typing import Any, ClassVar, Dict, List, Optional
22+
from typing import Any, ClassVar, Dict, List
2323
from typing import Optional, Set
2424
from typing_extensions import Self
2525

2626
class IdentificationTaskResultRequest(BaseModel):
2727
"""
2828
IdentificationTaskResultRequest
2929
""" # noqa: E501
30-
source: Optional[StrictStr]
30+
source: StrictStr
3131
__properties: ClassVar[List[str]] = ["source"]
3232

3333
@field_validator('source')
3434
def source_validate_enum(cls, value):
3535
"""Validates the enum"""
36-
if value is None:
37-
return value
38-
3936
if value not in set(['expert', 'ai']):
4037
raise ValueError("must be one of enum values ('expert', 'ai')")
4138
return value
@@ -79,11 +76,6 @@ def to_dict(self) -> Dict[str, Any]:
7976
exclude=excluded_fields,
8077
exclude_none=True,
8178
)
82-
# set to None if source (nullable) is None
83-
# and model_fields_set contains the field
84-
if self.source is None and "source" in self.model_fields_set:
85-
_dict['source'] = None
86-
8779
return _dict
8880

8981
@classmethod

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mosquito_alert"
3-
version = "0.1.20"
3+
version = "0.1.21"
44
description = "Mosquito Alert API"
55
authors = ["Developers <[email protected]>"]
66
license = "GPL-3"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# prerequisite: setuptools
2323
# http://pypi.python.org/pypi/setuptools
2424
NAME = "mosquito-alert"
25-
VERSION = "0.1.20"
25+
VERSION = "0.1.21"
2626
PYTHON_REQUIRES = ">= 3.9"
2727
REQUIRES = [
2828
"urllib3 >= 2.1.0, < 3.0.0",

0 commit comments

Comments
 (0)