Skip to content

Commit

Permalink
Make doc of global comp. labels consistent
Browse files Browse the repository at this point in the history
The documentation used different format than all other resource.

The create action documentation now does not mention the description
field which is not used anyway. See PDC-611.

The links in documentation lead to page causing internal server error.
While unfortunate, this already happens on global/release component
contacts
  • Loading branch information
lubomir committed Aug 25, 2015
1 parent 8eb92ee commit ca52d3b
Showing 1 changed file with 18 additions and 36 deletions.
54 changes: 18 additions & 36 deletions pdc/apps/component/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,34 +498,26 @@ def get_queryset(self):

def list(self, request, *args, **kwargs):
"""
Show the global component labels by pagination, 20 items per page by default, and you can pass some parameters
to filter the result.
__Method__: `GET`
__Request__
__URL__: $LINK:globalcomponentlabel-list:component_id$
curl -X GET -H "Content-Type: application/json" $URL:globalcomponentlabel-list:1$
Or search specified global component's label by label's name.
curl -G -H "Content-Type: application/json" $URL:globalcomponentlabel-list:1$ -d name=label1
Now it supports ``name`` to filter the result.
__Query params__:
``name``: label's name
%(FILTERS)s
__Response__: a paged list of following objects
%(SERIALIZER)s
"""
return super(GlobalComponentLabelViewSet, self).list(request, *args, **kwargs)

def retrieve(self, request, *args, **kwargs):
"""
Show the specified global component label instance.
__Method__: `GET`
__Request__
curl -X GET -H "Content-Type: application/json" $URL:globalcomponentlabel-detail:1:1$
__URL__: $LINK:globalcomponentlabel-detail:component_id:label_id$
__Response__:
Expand All @@ -541,19 +533,10 @@ def bulk_update(self, request, *args, **kwargs):

def destroy(self, request, *args, **kwargs):
"""
Delete a label from a specified global component, return an empty response if success.
####__Request__####
curl -X DELETE -H "Content-Type: application/json" $URL:globalcomponentlabel-detail:1:1$
####__Response__####
HTTP 204 NO CONTENT
Date: Mon, 20 Oct 2014 06:21:21 GMT
Content-Length: 0
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Delete a label from a specified global component, return an empty
response if success.
__URL__: $LINK:globalcomponentlabel-detail:component_id:label_id$
"""
pk = self.kwargs.get('pk')
label = get_object_or_404(Label, id=pk)
Expand All @@ -577,20 +560,19 @@ def create(self, request, *args, **kwargs):
**Note**: label must exist before being assigned to a global_component.
####__Request__####
__Method__: `POST`
``name``: label's name, **REQUIRED**
__URL__: $LINK:globalcomponentlabel-list:component_id$
``description``: label's description, **OPTIONAL**
__Data__:
curl -X POST -H "Content-Type: application/json" $URL:globalcomponentlabel-list:1$ -d '{"name": "label1"}'
{
"name": "string"
}
####__Response__####
__Response__:
HTTP 201 CREATED
Date: Mon, 20 Oct 2014 06:01:04 GMT
Content-Type: application/json
Allow: GET, POST, HEAD, OPTIONS
%(SERIALIZER)s
"""
extra_keys = set(request.data.keys()) - self.serializer_class().get_allowed_keys()
StrictSerializerMixin.maybe_raise_error(extra_keys)
Expand Down

0 comments on commit ca52d3b

Please sign in to comment.