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

Nested serializer on response schema #90

Open
fernandolins opened this issue Nov 16, 2017 · 0 comments
Open

Nested serializer on response schema #90

fernandolins opened this issue Nov 16, 2017 · 0 comments
Milestone

Comments

@fernandolins
Copy link

  • DRF OpenAPI version: 1.0.0
  • Python version: 3.6.3
  • Operating System: OS X

Description

I have a model which has two relationship with two different models one is a ForeignKey and the other is a ManyToMany.
The list view of this model shows only two depth levels, but I would like to see all depth levels or choose the level that I want passing depth=3 in class Meta

Current Behavior:

{
  "count": 0,
  "next": "string",
  "previous": "string",
  "results": [
    {
      "id": 0,
      "countries": [ ],
      "category": { },
      "title": "string",
      "description": "string"
    }
  ]
}

Expected behavior:

{
  "count": 0,
  "next": "string",
  "previous": "string",
  "results": [
    {
      "id": 0,
      "countries": [
        {
          "id": 0,
          "code": "string"
        }
      ],
      "category": {
        "id": 0,
        "name": "string"
      },
      "title": "string",
      "description": "string"
    }
  ]
}

Is there a way to do that? Or do you think it's may be a new feature?

@limdauto limdauto added this to the v2.0 milestone Dec 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants