Skip to content

Commit

Permalink
Make "location" argument required in OpenAPIConverter.schema2parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrech committed Jan 3, 2020
1 parent da79605 commit 6b25286
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/apispec/ext/marshmallow/openapi.py
Expand Up @@ -110,7 +110,7 @@ def resolve_nested_schema(self, schema):
return self.get_ref_dict(schema_instance)

def schema2parameters(
self, schema, *, location="body", name="body", required=False, description=None
self, schema, *, location, name="body", required=False, description=None
):
"""Return an array of OpenAPI parameters given a given marshmallow
:class:`Schema <marshmallow.Schema>`. If `location` is "body", then return an array
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_marshmallow.py
Expand Up @@ -770,7 +770,7 @@ def test_schema_global_state_untouched_2json(self, spec_fixture):

def test_schema_global_state_untouched_2parameters(self, spec_fixture):
assert get_nested_schema(RunSchema, "sample") is None
data = spec_fixture.openapi.schema2parameters(RunSchema)
data = spec_fixture.openapi.schema2parameters(RunSchema, location="json")
json.dumps(data)
assert get_nested_schema(RunSchema, "sample") is None

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ext_marshmallow_openapi.py
Expand Up @@ -268,7 +268,7 @@ def test_field_required(self, openapi):

def test_invalid_schema(self, openapi):
with pytest.raises(ValueError):
openapi.schema2parameters(None)
openapi.schema2parameters(None, location="json")

# json/body is invalid for OpenAPI 3
@pytest.mark.parametrize("openapi", ("2.0",), indirect=True)
Expand Down

0 comments on commit 6b25286

Please sign in to comment.