Error out in human friendly way if mimetype is missing on response
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start in openapi_core/validation/response/validators.py at the response data lookup, then inspect schema/responses/models.py and schema/content/models.py where the missing mimetype reaches fnmatch. Reproduce the None-mimetype case and make the resulting failure human-friendly, with a test showing the expected error.
Written by the indexing model from the issue text.
Description
Currently one gets:
../../../../.local/share/virtualenvs/woocart-api-zie1bQwL/lib/python3.6/site-packages/openapi_core/validation/response/validators.py:37: in validate
data, data_errors = self._get_data(response, operation_response)
../../../../.local/share/virtualenvs/woocart-api-zie1bQwL/lib/python3.6/site-packages/openapi_core/validation/response/validators.py:53: in _get_data
media_type = operation_response[response.mimetype]
../../../../.local/share/virtualenvs/woocart-api-zie1bQwL/lib/python3.6/site-packages/openapi_core/schema/responses/models.py:21: in __getitem__
return self.content[mimetype]
../../../../.local/share/virtualenvs/woocart-api-zie1bQwL/lib/python3.6/site-packages/openapi_core/schema/content/models.py:18: in __getitem__
if fnmatch.fnmatch(mimetype, key):
../../../../.local/share/virtualenvs/woocart-api-zie1bQwL/lib/python3.6/fnmatch.py:34: in fnmatch
name = os.path.normcase(name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = None
def normcase(s):
"""Normalize case of pathname. Has no effect under Posix"""
> s = os.fspath(s)
E TypeError: expected str, bytes or os.PathLike object, not NoneType
- Dominant language
- Python
- Stars
- 368
- Forks
- 140
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-openapi/openapi-core
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python-openapi/openapi-core#1188 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1225 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value Openkind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
Difficulty 3/5 1-2 days Newbie friendliness 58/100
python-openapi/openapi-core#1180 · 3 comments ·
All issues in python-openapi/openapi-core
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·