Skip to content

Commit

Permalink
Only log x-body-name deprecation warning when used incorrectly (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders authored May 4, 2022
1 parent 792bc4d commit cff0310
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions connexion/operations/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,13 @@ def _get_body_argument(self, body, arguments, has_kwargs, sanitize):

if not x_body_name:
# x-body-name also accepted in the schema field for legacy connexion compat
warnings.warn('x-body-name within the requestBody schema will be deprecated in the '
'next major version. It should be provided directly under '
'the requestBody instead.', DeprecationWarning)
x_body_name = sanitize(self.body_schema.get('x-body-name', 'body'))

if x_body_name:
warnings.warn('x-body-name within the requestBody schema will be deprecated in the '
'next major version. It should be provided directly under '
'the requestBody instead.', DeprecationWarning)

if self.consumes[0] in FORM_CONTENT_TYPES:
result = self._get_body_argument_form(body)
else:
Expand Down

0 comments on commit cff0310

Please sign in to comment.