Skip to content

Commit

Permalink
chore: remove RemovedInMarshmallow4 warnings (#23704)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianliebscher authored and pull[bot] committed Mar 20, 2024
1 parent 050f625 commit 20e5ed0
Show file tree
Hide file tree
Showing 23 changed files with 1,112 additions and 693 deletions.
6 changes: 4 additions & 2 deletions superset/advanced_data_type/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class AdvancedDataTypeSchema(Schema):
"""

error_message = fields.String()
values = fields.List(fields.String(description="parsed value (can be any value)"))
values = fields.List(
fields.String(metadata={"description": "parsed value (can be any value)"})
)
display_value = fields.String(
description="The string representation of the parsed values"
metadata={"description": "The string representation of the parsed values"}
)
valid_filter_operators = fields.List(fields.String())
28 changes: 18 additions & 10 deletions superset/annotation_layers/annotations/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,46 @@ def validate_json(value: Union[bytes, bytearray, str]) -> None:

class AnnotationPostSchema(Schema):
short_descr = fields.String(
description=annotation_short_descr,
metadata={"description": annotation_short_descr},
required=True,
allow_none=False,
validate=[Length(1, 500)],
)
long_descr = fields.String(description=annotation_long_descr, allow_none=True)
long_descr = fields.String(
metadata={"description": annotation_long_descr}, allow_none=True
)
start_dttm = fields.DateTime(
description=annotation_start_dttm,
metadata={"description": annotation_start_dttm},
required=True,
allow_none=False,
)
end_dttm = fields.DateTime(
description=annotation_end_dttm, required=True, allow_none=False
metadata={"description": annotation_end_dttm}, required=True, allow_none=False
)
json_metadata = fields.String(
description=annotation_json_metadata,
metadata={"description": annotation_json_metadata},
validate=validate_json,
allow_none=True,
)


class AnnotationPutSchema(Schema):
short_descr = fields.String(
description=annotation_short_descr, required=False, validate=[Length(1, 500)]
metadata={"description": annotation_short_descr},
required=False,
validate=[Length(1, 500)],
)
long_descr = fields.String(
description=annotation_long_descr, required=False, allow_none=True
metadata={"description": annotation_long_descr}, required=False, allow_none=True
)
start_dttm = fields.DateTime(
metadata={"description": annotation_start_dttm}, required=False
)
end_dttm = fields.DateTime(
metadata={"description": annotation_end_dttm}, required=False
)
start_dttm = fields.DateTime(description=annotation_start_dttm, required=False)
end_dttm = fields.DateTime(description=annotation_end_dttm, required=False)
json_metadata = fields.String(
description=annotation_json_metadata,
metadata={"description": annotation_json_metadata},
validate=validate_json,
required=False,
allow_none=True,
Expand Down
16 changes: 12 additions & 4 deletions superset/annotation_layers/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@

class AnnotationLayerPostSchema(Schema):
name = fields.String(
description=annotation_layer_name, required=True, validate=[Length(1, 250)]
metadata={"description": annotation_layer_name},
required=True,
validate=[Length(1, 250)],
)
descr = fields.String(
metadata={"description": annotation_layer_descr}, allow_none=True
)
descr = fields.String(description=annotation_layer_descr, allow_none=True)


class AnnotationLayerPutSchema(Schema):
name = fields.String(
description=annotation_layer_name, required=False, validate=[Length(1, 250)]
metadata={"description": annotation_layer_name},
required=False,
validate=[Length(1, 250)],
)
descr = fields.String(
metadata={"description": annotation_layer_descr}, required=False
)
descr = fields.String(description=annotation_layer_descr, required=False)
12 changes: 6 additions & 6 deletions superset/cachekeys/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@

class Datasource(Schema):
database_name = fields.String(
description="Datasource name",
metadata={"description": "Datasource name"},
)
datasource_name = fields.String(
description=datasource_name_description,
metadata={"description": datasource_name_description},
)
schema = fields.String(
description="Datasource schema",
metadata={"description": "Datasource schema"},
)
datasource_type = fields.String(
description=datasource_type_description,
metadata={"description": datasource_type_description},
validate=validate.OneOf(choices=[ds.value for ds in DatasourceType]),
required=True,
)
Expand All @@ -45,9 +45,9 @@ class Datasource(Schema):
class CacheInvalidationRequestSchema(Schema):
datasource_uids = fields.List(
fields.String(),
description=datasource_uid_description,
metadata={"description": datasource_uid_description},
)
datasources = fields.List(
fields.Nested(Datasource),
description="A list of the data source and database names",
metadata={"description": "A list of the data source and database names"},
)
Loading

0 comments on commit 20e5ed0

Please sign in to comment.