Project

Profile

Help

Story #4279

closed

Namespace plugin endpoints for viewsets of master/detail models.

Added by ttereshc almost 6 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 48
Quarter:

Description

At the moment plugins specify the plugin name or some identifier to namespace their endpoints manually as a part of endpoint_name when they write their viewsets,
e.g. for PackageViewSet: endpoint_name = 'rpm/packages', for UpdateRecordViewSet: endpoint_name = 'rpm/errata', etc.

Currently it's mostly a problem for ContentViewSets and less of a problem for Remotes, Publishers, etc, since it's common for a single plugin to support multiple content types.

The suggestion is to prepend endpoint_name of a viewset of any detail model automagically with a plugin name which is defined as a Django app label.
For the plugins it is recommended to drop the 'pulp_' part of their Django app label.

E.g.: For PackageViewSet: endpoint_name will be 'packages', and the Django label will change "pulp_rpm" -> "rpm", so for there is no change in content endpoints:

/api/v3/content/rpm/packages/

Remotes'/Publishers'/other "detail" endpoints will change this way (first "rpm" is a Django label, second "rpm" is endpoint_name defined on a viewset):

/api/v3/remotes/rpm/ --> /api/v3/content/remotes/rpm/rpm/
/api/v3/publishers/rpm/ --> /api/v3/content/publishers/rpm/rpm/

Also available in: Atom PDF