Wrap response schemas in a schema object

This commit is contained in:
Lucidiot 2019-04-04 11:06:52 +02:00
parent 5ff849bd76
commit 070077603f
2 changed files with 7 additions and 4 deletions

View File

@ -800,6 +800,9 @@ class OpenAPIAutoSchema(ViewInspector):
return {
'200': {
'content': {ct: content for ct in self.content_types}
'content': {
ct: {'schema': content}
for ct in self.content_types
}
}
}

View File

@ -59,7 +59,7 @@ class TestOperationIntrospection(TestCase):
assert operation == {
'operationId': 'ListExamples',
'parameters': [],
'responses': {'200': {'content': {'application/json': {}}}},
'responses': {'200': {'content': {'application/json': {'schema': {}}}}},
}
def test_path_with_id_parameter(self):
@ -128,8 +128,8 @@ class TestOperationIntrospection(TestCase):
inspector.view = view
responses = inspector._get_responses(path, method)
assert responses['200']['content']['application/json']['required'] == ['text']
assert list(responses['200']['content']['application/json']['properties'].keys()) == ['text']
assert responses['200']['content']['application/json']['schema']['required'] == ['text']
assert list(responses['200']['content']['application/json']['schema']['properties'].keys()) == ['text']
@pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.')