Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement new uploads to the addon api, for listed too. #17765

Closed
wants to merge 1 commit into from

Conversation

eviljeff
Copy link
Member

@eviljeff eviljeff commented Aug 23, 2021

Basic flow:

  1. Upload the file to be validated via POSTing to api/v5/addons/submission/ to create a FileUpload (returns a serialized response that contains the upload UUID). The upload is where channel is set.
  2. optional - you can check on validation status at api/v5/addons/submission/<uuid>
  3. with a valid upload, submit it as a new addon to api/v5/addons/addon/ with json like {"categories": {"firefox": ["bookmarks"]}, "version": {"upload": "<uuid>", "license": 7}}
  4. or can be submitted as a new version to an existing addon via api/v5/addons/addon/<addon slug or id or guid>/versions/ with json like {"upload": "<uuid>", "license": 7}

Known limitations:

  • you can only select from pre-defined licenses - and only by specifying a numeric license id. So worked needed to:
    • implement the ability to create a custom license
    • select from predefined licenses by slug or some other mnemonic
    • maybe make the field optional (for listed versions only?) and default to all rights reserved, or the previous license for subsequent versions
  • FileUploadViewSet needs refactoring to move most/all of the creation logic into FileUploadSerializer
  • categories are required to create an add-on but aren't really needed unless the add-on has listed versions
  • For the first listed version we want to require all the necessary metadata (name, summary, categories, version license) being defined if not available in the manifest, but not really for unlisted versions. This will necessitate some refactoring - probably moving some validation from AddonSerializer to VersionSerializer.
  • source code submission isn't implemented
  • there are some fields on AddonSerializer that should be writable but are currently either SerializerMethodFields or custom Fields/Serializers that don't have a working write implementation.
  • setting default_locale did unexpected things during Addon creation with respect to data in the manifest so left it read only.
  • Only CreateModelMixin has been added to the views to limit the scope of the changes/tests. The serializers should handle updates without a massive amount of extra work (in theory!).
  • probably many other things

when the feature is launched mozilla/addons#5348 will be fixed, but it's a way off at this point

@eviljeff

This comment has been minimized.

@eviljeff eviljeff force-pushed the 00000-addon-submit-api branch from d655b73 to 0d98c65 Compare September 14, 2021 16:13
@eviljeff eviljeff marked this pull request as ready for review September 14, 2021 16:36
@eviljeff eviljeff force-pushed the 00000-addon-submit-api branch 2 times, most recently from 7a68d4d to 1b386b8 Compare September 14, 2021 17:21
@eviljeff eviljeff force-pushed the 00000-addon-submit-api branch from 1b386b8 to 59788ae Compare September 14, 2021 17:22
@eviljeff
Copy link
Member Author

eviljeff commented Sep 14, 2021

I'm going to move the random fixes/changes I made elsewhere into a separate patch, so this can be focused on new code relating to the api

@eviljeff eviljeff requested review from diox and removed request for diox September 15, 2021 10:59
@eviljeff
Copy link
Member Author

@diox changed my mind - I was just looking for an initial review to confirm it makes sense but I'm going to split out the refactoring and re-open this as a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant