diff --git a/rest_framework/schemas/openapi.py b/rest_framework/schemas/openapi.py index fa887d63a..9c6610eaf 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -413,6 +413,7 @@ class AutoSchema(ViewInspector): properties[field.field_name] = schema result = { + 'type': 'object', 'properties': properties } if required: diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index b4cb2823f..0bee0a167 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -335,6 +335,7 @@ class TestOperationIntrospection(TestCase): 'schema': { 'type': 'array', 'items': { + 'type': 'object', 'properties': { 'text': { 'type': 'string', @@ -386,6 +387,7 @@ class TestOperationIntrospection(TestCase): 'item': { 'type': 'array', 'items': { + 'type': 'object', 'properties': { 'text': { 'type': 'string', @@ -532,6 +534,7 @@ class TestOperationIntrospection(TestCase): 'content': { 'application/json': { 'schema': { + 'type': 'object', 'properties': { 'text': { 'type': 'string',