13
13
14
14
@pytest .fixture ()
15
15
def marshmallow_plugin ():
16
- return MarshmallowPlugin (schema_name_resolver = lambda x : None )
16
+ return MarshmallowPlugin ()
17
17
18
18
@pytest .fixture
19
19
def spec (marshmallow_plugin ):
@@ -28,6 +28,10 @@ def spec(marshmallow_plugin):
28
28
def openapi (marshmallow_plugin ):
29
29
return marshmallow_plugin .openapi
30
30
31
+ def ref_path (spec ):
32
+ if spec .openapi_version .version [0 ] < 3 :
33
+ return "#/definitions/"
34
+ return "#/components/schemas/"
31
35
32
36
def test_error_if_spec_does_not_have_marshmallow_plugin (app ):
33
37
bad_spec = APISpec (
@@ -79,8 +83,7 @@ def test_params(self, app, path):
79
83
def test_responses (self , schemas , path , openapi ):
80
84
response = path ['get' ]['responses' ]['default' ]
81
85
assert response ['description' ] == 'a band'
82
- expected = openapi .schema2jsonschema (schemas .BandSchema )
83
- assert response ['schema' ] == expected
86
+ assert response ['schema' ] == {'$ref' : ref_path (openapi .spec ) + 'Band' }
84
87
85
88
def test_tags (self , path ):
86
89
assert path ['get' ]['tags' ] == ['band' ]
@@ -190,8 +193,7 @@ def test_params(self, app, path, openapi):
190
193
def test_responses (self , schemas , path , openapi ):
191
194
response = path ['get' ]['responses' ]['default' ]
192
195
assert response ['description' ] == 'a band'
193
- expected = openapi .schema2jsonschema (schemas .BandSchema )
194
- assert response ['schema' ] == expected
196
+ assert response ['schema' ] == {'$ref' : ref_path (openapi .spec ) + 'Band' }
195
197
196
198
def test_tags (self , path ):
197
199
assert path ['get' ]['tags' ] == ['band' ]
0 commit comments