Skip to content

Commit 79d37bc

Browse files
authored
OpenAPI: Include type key in schema object properties dict. (#7169)
1 parent bc4d525 commit 79d37bc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

rest_framework/schemas/openapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ def _map_serializer(self, serializer):
413413
properties[field.field_name] = schema
414414

415415
result = {
416+
'type': 'object',
416417
'properties': properties
417418
}
418419
if required:

tests/schemas/test_openapi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ class View(generics.GenericAPIView):
335335
'schema': {
336336
'type': 'array',
337337
'items': {
338+
'type': 'object',
338339
'properties': {
339340
'text': {
340341
'type': 'string',
@@ -386,6 +387,7 @@ class View(generics.GenericAPIView):
386387
'item': {
387388
'type': 'array',
388389
'items': {
390+
'type': 'object',
389391
'properties': {
390392
'text': {
391393
'type': 'string',
@@ -532,6 +534,7 @@ class View(generics.GenericAPIView):
532534
'content': {
533535
'application/json': {
534536
'schema': {
537+
'type': 'object',
535538
'properties': {
536539
'text': {
537540
'type': 'string',

0 commit comments

Comments
 (0)