mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-22 19:18:36 +00:00
Parameter get_value restructure
This commit is contained in:
parent
da9838b3ac
commit
7aaa5170a6
1 changed files with 3 additions and 5 deletions
|
@ -75,9 +75,7 @@ class Parameter(object):
|
||||||
def get_value(self, request):
|
def get_value(self, request):
|
||||||
location = request.parameters[self.location.value]
|
location = request.parameters[self.location.value]
|
||||||
|
|
||||||
try:
|
if self.name not in location:
|
||||||
raw = location[self.name]
|
|
||||||
except KeyError:
|
|
||||||
if self.required:
|
if self.required:
|
||||||
raise MissingRequiredParameter(
|
raise MissingRequiredParameter(
|
||||||
"Missing required `{0}` parameter".format(self.name))
|
"Missing required `{0}` parameter".format(self.name))
|
||||||
|
@ -86,12 +84,12 @@ class Parameter(object):
|
||||||
raise MissingParameter(
|
raise MissingParameter(
|
||||||
"Missing `{0}` parameter".format(self.name))
|
"Missing `{0}` parameter".format(self.name))
|
||||||
|
|
||||||
raw = self.schema.default
|
return self.schema.default
|
||||||
|
|
||||||
if self.aslist and self.explode:
|
if self.aslist and self.explode:
|
||||||
return location.getlist(self.name)
|
return location.getlist(self.name)
|
||||||
|
|
||||||
return raw
|
return location[self.name]
|
||||||
|
|
||||||
def unmarshal(self, value):
|
def unmarshal(self, value):
|
||||||
if self.deprecated:
|
if self.deprecated:
|
||||||
|
|
Loading…
Reference in a new issue