django-rest-framework icon indicating copy to clipboard operation
django-rest-framework copied to clipboard

Pagination OpenAPI schemas should mark fields as required

Open rvinzent opened this issue 4 years ago • 3 comments

Checklist

  • [ ] Raised initially as discussion #...
  • [x] This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • [x] I have reduced the issue to the simplest possible case.

Description

The schema for paginated responses should mark fields as required as there are no cases where an Ok response omits any of the fields. They are correctly marked nullable: true, but they should also be set to required. This causes OpenAPI client generators to generate nullable properties for count and results on the LimitOffsetPagination response.

Example of schema without required fields. The OpenAPI schema for these paginators should set fields to be required so clients can assume they are always present to match the actual behavior of paginated responses.

rvinzent avatar Jan 21 '22 23:01 rvinzent

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 25 '22 01:03 stale[bot]

Is there any chance this ticket will ever be addressed?

rvinzent avatar Mar 25 '22 01:03 rvinzent

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 31 '22 04:05 stale[bot]

if anyone contribute, then might be yes, but if not, DRF now suggest using drf-spectacular as default schema tool

auvipy avatar Nov 23 '22 06:11 auvipy