mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

allow tags to be writeable via the addon api #8581

Closed eviljeff closed 2 years ago

eviljeff commented 2 years ago

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.

ioanarusiczki commented 2 years ago

@eviljeff

On AMO dev:

These are all expected.

I've noticed 2 things:

Let me know if I should file issues for these 2.

eviljeff commented 2 years ago

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.