Hi,

I have a large API. I have documented it using Swagger 0.3.X. That version 
allowed me to use YAML. I am able to document query parameters in YAML, and 
swagger forms are generated automatically for the client side developer to 
test / write code.

In django-rest-swagger 2.X, YAML is dropped and Schema based generation is 
used instead.

I installed 2.1. I have the swagger pages. However, the way my API is 
written, the request parameters are not introspected so the Swagger forms 
are not generated correctly.

Can anyone provide me with an example of a ViewSet that correctly generates 
Swagger forms with django-rest-swagger version 2.1. I expect to have query 
parameters available as input fields in the swagger UI. I am assuming that 
I can provide extra methods or decorators to the code to link schema 
information to the end-points, but I cannot work it out from the docs.

Here is an example of code from my version 0.3.X system...

    @detail_route(methods=['post'])
    def transfer(self, request, namespace):
        """
            Transfer a self-registration request to another centre to be 
processed.
            ---
            type:
                success:
                  description: did the request succeed?
                  type: boolean
                message:
                  description: Error information if the request failed
                  type: string

            parameters_strategy:
                form: replace

            parameters:
                - name: namespace
                  description: Url code for the app.
                  type: string
                  required: true
                  paramType: path
                - name: queue
                  description: id of the item in the self-registration queue
                  type: uuid
                  required: true
                - name: centre
                  description: The centre to process the request
                  type: integer
                  required: true

        """
        queue_id = request.data['queue']
        centre = request.data['centre']

Thanks

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to