betodealmeida commented on code in PR #25309: URL: https://github.com/apache/superset/pull/25309#discussion_r1326581970
########## superset-frontend/src/features/tags/BulkTagModal.tsx: ########## @@ -45,13 +45,19 @@ const BulkTagModal: React.FC<BulkTagModalProps> = ({ addDangerToast, }) => { useEffect(() => {}, []); + const [tags, setTags] = useState<TaggableResourceOption[]>([]); const onSave = async () => { await SupersetClient.post({ endpoint: `/api/v1/tag/bulk_create`, jsonPayload: { - tags: tags.map(tag => tag.value), - objects_to_tag: selected.map(item => [resourceName, +item.original.id]), + tags: tags.map(tag => ({ + name: tag.value, + objects_to_tag: selected.map(item => [ + resourceName, + +item.original.id, Review Comment: Are we using the `+` to cast to a number? ########## superset/tags/schemas.py: ########## @@ -59,22 +59,24 @@ class TagPostSchema(Schema): description = fields.String(required=False, allow_none=True) # resource id's to tag with tag objects_to_tag = fields.List( - fields.Tuple((fields.String(), fields.Int())), required=False + fields.Tuple((fields.String(), fields.Int())), required=False, allow_none=True ) +class TagPostBulkObject(Schema): + name = fields.String() + resource_type = fields.String() + resource_id = fields.Int() + + class TagPostBulkSchema(Schema): - tags = fields.List(fields.String()) - # resource id's to tag with tag - objects_to_tag = fields.List( - fields.Tuple((fields.String(), fields.Int())), required=False - ) + tags = fields.List(fields.Nested(TagPostBulkObject)) class TagPutSchema(Schema): name = fields.String() description = fields.String(required=False, allow_none=True) # resource id's to tag with tag objects_to_tag = fields.List( - fields.Tuple((fields.String(), fields.Int())), required=False + fields.Tuple((fields.String(), fields.Int())), required=False, allow_none=True Review Comment: Same here, we shouldn't allow null values. ########## superset/tags/schemas.py: ########## @@ -59,22 +59,24 @@ class TagPostSchema(Schema): description = fields.String(required=False, allow_none=True) # resource id's to tag with tag objects_to_tag = fields.List( - fields.Tuple((fields.String(), fields.Int())), required=False + fields.Tuple((fields.String(), fields.Int())), required=False, allow_none=True Review Comment: Why do we allow `None` here? It seems to be it's better to not allow `None`, and filter them out in the frontend, since it doesn't make sense for the client to send a null value here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org