diff --git a/platform_neuro_flow_api/api.py b/platform_neuro_flow_api/api.py index aa504f6..3c5520b 100644 --- a/platform_neuro_flow_api/api.py +++ b/platform_neuro_flow_api/api.py @@ -485,12 +485,12 @@ def storage(self) -> Storage: @docs(tags=["bakes"], summary="List bakes in given project") @query_schema( project_id=fields.String(required=True), - name=fields.String(missing=None), - tags=fields.List(fields.String(), missing=tuple()), - since=fields.AwareDateTime(missing=None), - until=fields.AwareDateTime(missing=None), - reverse=fields.Boolean(missing=False), - fetch_last_attempt=fields.Boolean(missing=False), + name=fields.String(load_default=None), + tags=fields.List(fields.String(), load_default=tuple()), + since=fields.AwareDateTime(load_default=None), + until=fields.AwareDateTime(load_default=None), + reverse=fields.Boolean(load_default=False), + fetch_last_attempt=fields.Boolean(load_default=False), ) @response_schema(BakeSchema(many=True), HTTPOk.status_code) async def list( @@ -571,7 +571,7 @@ async def create( @docs(tags=["bakes"], summary="Get bake by id") @query_schema( - fetch_last_attempt=fields.Boolean(missing=False), + fetch_last_attempt=fields.Boolean(load_default=False), ) @response_schema(BakeSchema(), HTTPOk.status_code) async def get( @@ -593,7 +593,7 @@ async def get( @query_schema( project_id=fields.String(required=True), name=fields.String(required=True), - fetch_last_attempt=fields.Boolean(missing=False), + fetch_last_attempt=fields.Boolean(load_default=False), ) @response_schema(BakeSchema(), HTTPOk.status_code) async def get_by_name( diff --git a/platform_neuro_flow_api/schema.py b/platform_neuro_flow_api/schema.py index 8f5b072..059f346 100644 --- a/platform_neuro_flow_api/schema.py +++ b/platform_neuro_flow_api/schema.py @@ -75,7 +75,7 @@ class LiveJobSchema(Schema): project_id = fields.String(required=True) multi = fields.Boolean(required=True) tags = fields.List(fields.String(), required=True) - raw_id = fields.String(missing="") + raw_id = fields.String(load_default="") @post_load def make_live_job_data(self, data: Mapping[str, Any], **kwargs: Any) -> LiveJobData: @@ -116,8 +116,10 @@ class BakeSchema(Schema): id = fields.String(required=True, dump_only=True) project_id = fields.String(required=True) batch = fields.String(required=True) - created_at = fields.AwareDateTime(missing=lambda: datetime.now(timezone.utc)) - meta = fields.Nested(BakeMetaSchema, required=False, missing=lambda: BakeMeta(None)) + created_at = fields.AwareDateTime(load_default=lambda: datetime.now(timezone.utc)) + meta = fields.Nested( + BakeMetaSchema, required=False, load_default=lambda: BakeMeta(None) + ) graphs = fields.Dict( keys=FullIDField(), values=fields.Dict(keys=FullIDField(), values=fields.List(FullIDField())), @@ -174,7 +176,7 @@ class AttemptSchema(Schema): bake_id = fields.String(required=True) number = fields.Integer(required=True, strict=True) created_at = fields.AwareDateTime( - missing=lambda: datetime.now(timezone.utc) + load_default=lambda: datetime.now(timezone.utc) ) # when result = TaskStatusField(required=True) configs_meta = fields.Nested(ConfigsMetaSchema(), required=True) @@ -199,13 +201,13 @@ class TaskSchema(Schema): raw_id = fields.String(required=True, allow_none=True) # empty string for no id outputs = fields.Dict( allow_none=True, - default=None, + dump_default=None, keys=fields.String(required=True), values=fields.String(required=True), ) state = fields.Dict( allow_none=True, - default=None, + dump_default=None, keys=fields.String(required=True), values=fields.String(required=True), ) @@ -230,8 +232,8 @@ class CacheEntrySchema(Schema): task_id = FullIDField(required=True) batch = fields.String(required=True) key = fields.String(required=True) - created_at = fields.AwareDateTime(missing=lambda: datetime.now(timezone.utc)) - raw_id = fields.String(missing="") + created_at = fields.AwareDateTime(load_default=lambda: datetime.now(timezone.utc)) + raw_id = fields.String(load_default="") outputs = fields.Dict(values=fields.String(), required=True) state = fields.Dict(values=fields.String(), required=True) diff --git a/setup.cfg b/setup.cfg index 27be41c..a2cead5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,7 @@ install_requires = neuro-logging==21.12.2 neuro-sdk==22.1.3 aiohttp-cors==0.7.0 - marshmallow==3.12.2 + marshmallow==3.16.0 aiohttp-apispec==2.2.3 markupsafe==2.1.1 alembic==1.7.7 @@ -42,6 +42,7 @@ asyncio_mode = auto filterwarnings= error ignore::DeprecationWarning:jose + ignore::marshmallow.warnings.RemovedInMarshmallow4Warning:apispec.ext.marshmallow.field_converter [coverage:run] branch = True