1
Versions:
coreapi==2.3.1
Django==1.11.2
django-rest-framework==0.1.0
django-rest-swagger==2.1.2
django-silk==1.0.0
djangorestframework==3.6.3

API endpoint: /search?filter=("pages")?filter=("people")

In my SwaggerSchemaView I have defined the filter field as follows:

coreapi.Field(name="filters", description="=search(query)", location="query", type="array", required=True)

Swagger looks like this:

enter image description here

now when i provide the values in the value box, it results in the api of format:

/search?filter=("pages"),("people")

How can I make swagger respect the format I want that is

/search?filter=("pages")?filter=("people")

1 Answer 1

1

What you need is not supported by CoreAPI out of the box. It will be after this issue gets fixed - https://github.com/core-api/python-openapi-codec/issues/25

But it is available in OpenAPI(Swagger) using style and explode params - https://swagger.io/specification/

I would recommend writing your own swagger yaml instead of generating it from DRF as DRF is not aligned with Swagger to be able to extract all the required information from it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.