Closed eviljeff closed 2 years ago
@eviljeff
On AMO dev:
using the addon endpoint, tag information can be sent at creation
An example:
{"categories": {"firefox": ["general"]}, "version": {"upload": "3297f89108664056941524ca5692c8c3", "license": 18}, "compatibility": ["firefox", "android"], "tags": ["scholar", "download", "reddit", "chat", "dark mode", "facebook", "duckduckgo"], "summary": {"en-US":"a test for themes"}}
tags can be modified with a PATCH request
{"tags": ["scholar", "download", "reddit", "chat", "dark mode", "vpn"]}
more than 10 tags are not permitted -> "Ensure this field has no more than 10 elements."
, something not defined as tag (not part of the admin tag list) is a 404 not found.
These are all expected.
{"tags": []}
-> can't tell if it's expected but I guess it should be allowed.I've noticed 2 things:
same tag can be sent 10 times -> maybe using it twice should throw an error such as "duplicate tag"
{"tags": ["scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar"]}
I get the 201 Created on versions endpoint with a JSON where I add tags {"upload": "fd7dd5921fed461e8cf1dd0e3b501856", "license":18,"compatibility": ["firefox"], "tags": ["privacy", "pixiv"]}
and also a 200 response when I send a PATCH request such as
{"tags": ["privacy", "pixiv"]}
on https://addons-dev.allizom.org/api/v5/addons/addon/621000/versions/1693315/
I think this should throw some error instead, adding tags has no effect when creating new version or making changes on a specific version.
Let me know if I should file issues for these 2.
I've noticed 2 things:
* same tag can be sent 10 times -> maybe using it twice should throw an error such as "duplicate tag" `{"tags": ["scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar", "scholar"]}`
it's a weird input but duplicates are harmless - unless it's actually adding the same tag 10 times(!) (I don't think that's even possible at the database level)
* I get the 201 Created on versions endpoint with a JSON where I add tags `{"upload": "fd7dd5921fed461e8cf1dd0e3b501856", "license":18,"compatibility": ["firefox"], "tags": ["privacy", "pixiv"]}` and also a 200 response when I send a PATCH request such as `{"tags": ["privacy", "pixiv"]}` on https://addons-dev.allizom.org/api/v5/addons/addon/621000/versions/1693315/ I think this should throw some error instead, adding tags has no effect when creating new version or making changes on a specific version.
REST apis just ignore extra json keys and tags isn't a property for the version api so that's fine.
part of mozilla/addons#8516 - addon tags should be writeable. The tags are only allowed from a pre-selected list (how to expose that list via the API?), and limited to how many can be selected per addon.