I am working on a custom schema and got an error saying Object of type Boolean is not JSON serializable
on the Swagger documentation page.
import coreapi
import coreschema
from rest_framework.schemas import AutoSchema
class CustomSchema(AutoSchema):
def get_manual_fields(self, path, method):
manual_fields = []
if method == "POST":
manual_fields.extend(
[
coreapi.Field(
"custom_field",
required=False,
location="form",
description="custom field",
type=coreschema.Boolean()
)
]
)
return manual_fields
I noticed that using location="query"
would not yield the error above, but I need it in the form
for Swagger. Is there any workaround? Thanks in advance!