Closed Bug 900568 Opened 11 years ago Closed 11 years ago

Remove unused fields from Fireplace search and app API

Categories

(Marketplace Graveyard :: API, defect, P3)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
2013-12-03

People

(Reporter: robhudson, Assigned: ashort)

References

Details

There are a number of fields Fireplace doesn't use. We should get rid of them in the Fireplace API to reduce document size and processing.

Those fields, as told to me by the venerable basta, are:

absolute_url
app_type
categories
created
default_locale
payment_account
regions
supported_locales
weekly_downloads
Priority: -- → P3
Currently the Fireplace API and submission API are tied together in code but just bolted onto URL paths in different places. This will need some thought on how to separate these code paths or provide a flag to know when we're being called from the Fireplace API so we can bypass including a bunch of extra fields we don't need.
Current proposed idea pseudocode via Chuck:


class AppResource(Marketplace):
    app_serialization_function = app_to_dict

    def serialize(self, obj):
        return self.app_serialization_function(obj)


class FireplaceAppResource(AppResource):
    app_serialization_function = fireplace_app_to_dict


The `fireplace_app_to_dict` would return only the fields needed in the JSON object. And `app_to_dict` could be customized to match what the API needs.
I would love it even more if we could somehow use inheritance to prevent the need for serialization functions outside of these classes.

It's a bit abusive, but in cases where simply adding a field to Meta.fields isn't enough, we could use validate_<field> on DRF serialization classes to get the job done?

http://django-rest-framework.org/api-guide/serializers.html#field-level-validation
Assignee: robhudson.mozbugs → ashort
https://github.com/mozilla/zamboni/commit/302b9ca
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2013-12-03
You need to log in before you can comment on or make changes to this bug.