Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Nested serializer fields aren't described in the request body #113

Description

@jar3b
  • DRF OpenAPI version: 1.3.0
  • Python version: 3.6.2
  • Operating System: Ubuntu 16.04

Description

If main serializer has any nested serializers except ListSerializer (it's handled correctly), fields of this sub-serializers doesn't shown on html page with api description.

What I Did

class PersonSerializer(serializers.Serializer):
    first_name = serializers.CharField()
    last_name = serializers.CharField()

class DocumentSerializer(serializers.Serializer):
    doc_type= serializers.IntegerField()
    number = serializers.CharField()

class CheckDocRequestSerializer(serializers.Serializer):
    person = PersonSerializer()
    documents = serializers.ListField(child=DocumentSerializer())

Main serializer is CheckDocRequestSerializer and in this case fields doc_type, number will be shown for DocumentSerializer but PersonSerializer will be described as object without any sub-elements.

"Request example":

{
  "person": {},
  "documents": [
    {
      "doc_type": 0,
      "number": "string"
    }
  ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions