drf-spectacular icon indicating copy to clipboard operation
drf-spectacular copied to clipboard

handle examples with nested properties pagination

Open w00kie opened this issue 1 year ago • 0 comments

Referring to #1236, I've made the build_listed_example_value function travel recursively down the schema properties to generate a paginate example.

This should enable examples to work in case of custom pagination classes that have nested properties, such as one like this:

{
  "pagination": {
    "limit": 100,
    "offset": 300,
    "total": 123,
    "next": "/accounts/?offset=400&limit=100",
    "previous": "/accounts/?offset=200&limit=100"
  },
  "data": [
    {"field": 123}
  ]
}

w00kie avatar May 14 '24 04:05 w00kie