Project

Profile

Help

Issue #3351

The parameters in the api schema for the sync and publish endpoints are incorrect

Added by daviddavis over 3 years ago. Updated almost 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
1. Low
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 34
Quarter:

Description

The sync and publish endpoints are using the FileImporterSerializer and FilePublisherSerializer as their serializers (respectively). The problem is that this adds all the fields from Importer and Publisher to the docs for these endpoints—fields like name, etc.


Related issues

Blocked by Pulp - Issue #3420: Not able to access documentation endpointCLOSED - CURRENTRELEASE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 71910e8f View on GitHub
Added by jortel@redhat.com over 3 years ago

Define schema for detail routes. closes #3351

Revision 413563f3 View on GitHub
Added by jortel@redhat.com over 3 years ago

Define schema for detail routes. closes #3351

History

#1 Updated by daviddavis over 3 years ago

  • Tags Pulp 3, Pulp 3 MVP added

#2 Updated by jortel@redhat.com over 3 years ago

  • Sprint/Milestone set to 54
  • Triaged changed from No to Yes

#3 Updated by daviddavis over 3 years ago

  • Severity changed from 2. Medium to 1. Low

#4 Updated by jortel@redhat.com over 3 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to jortel@redhat.com

#5 Updated by daviddavis over 3 years ago

I think this issue may be fixed by https://github.com/pulp/pulp/pull/3234

#6 Updated by bizhang over 3 years ago

It looks like for every detail view you need to provide a manualschema. So for pulp_file sync it would look like:

diff --git a/pulp_file/app/viewsets.py b/pulp_file/app/viewsets.py
index 8c66efb..d9d08ec 100644
--- a/pulp_file/app/viewsets.py
+++ b/pulp_file/app/viewsets.py
@@ -10,6 +10,8 @@ from pulpcore.plugin.viewsets import (
     OperationPostponedResponse,
     PublisherViewSet,
     tags)
+from rest_framework.schemas import ManualSchema
+from rest_framework.compat import coreapi, coreschema

 from .models import FileContent, FileImporter, FilePublisher
 from .serializers import FileContentSerializer, FileImporterSerializer, FilePublisherSerializer
@@ -37,7 +39,17 @@ class FileImporterViewSet(ImporterViewSet):
     queryset = FileImporter.objects.all()
     serializer_class = FileImporterSerializer

-    @detail_route(methods=('post',))
+    @detail_route(methods=('post',),
+                  schema=ManualSchema(fields=[
+                      coreapi.Field(
+                          "repository",
+                          required=True,
+                          schema=coreschema.String()
+                      )
+                  ]),
+                  )
     def sync(self, request, pk):
         importer = self.get_object()
         repository = self.get_resource(request.data['repository'], Repository)

#7 Updated by rchan over 3 years ago

  • Sprint/Milestone changed from 54 to 56

#8 Updated by jortel@redhat.com over 3 years ago

  • Status changed from ASSIGNED to POST

#9 Updated by jortel@redhat.com over 3 years ago

  • Status changed from POST to MODIFIED

#10 Updated by daviddavis over 3 years ago

  • Status changed from MODIFIED to NEW

#11 Updated by daviddavis over 3 years ago

  • Blocked by Issue #3420: Not able to access documentation endpoint added

#12 Updated by daviddavis over 3 years ago

This was temporarily reverted in https://github.com/pulp/pulp_file/pull/50. We need to redo this work once https://pulp.plan.io/issues/3420 is merged.

#13 Updated by bmbouter over 3 years ago

  • Sprint set to Sprint 33

#14 Updated by bmbouter over 3 years ago

  • Sprint/Milestone deleted (56)

#15 Updated by jortel@redhat.com over 3 years ago

  • Sprint changed from Sprint 33 to Sprint 34

#16 Updated by milan over 3 years ago

  • Status changed from NEW to POST
  • Assignee changed from jortel@redhat.com to milan

#17 Updated by jortel@redhat.com over 3 years ago

  • Status changed from POST to MODIFIED

#18 Updated by bmbouter over 2 years ago

  • Tags deleted (Pulp 3, Pulp 3 MVP)

#19 Updated by bmbouter almost 2 years ago

  • Sprint/Milestone set to 0.1.0

#20 Updated by bmbouter almost 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF