Skip to content

Refuse to cast str or bytes to array #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Sep 13, 2022

Although str and bytes act as sequences in Python, they do not count as arrays according to OpenAPI, so we should not allow them to validate as arrays.

@codecov
Copy link

codecov bot commented Sep 13, 2022

Codecov Report

Merging #421 (7be7fcc) into master (692f2c6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 7be7fcc differs from pull request most recent head 1aece83. Consider uploading reports for the commit 1aece83 to get more accurate results

@@           Coverage Diff           @@
##           master     #421   +/-   ##
=======================================
  Coverage   93.38%   93.39%           
=======================================
  Files          97       97           
  Lines        2344     2346    +2     
  Branches      292      293    +1     
=======================================
+ Hits         2189     2191    +2     
  Misses        120      120           
  Partials       35       35           
Impacted Files Coverage Δ
openapi_core/casting/schemas/casters.py 93.33% <100.00%> (+0.31%) ⬆️
openapi_core/casting/schemas/exceptions.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@p1c2u p1c2u force-pushed the array-cast branch 2 times, most recently from 7be7fcc to a8c3729 Compare September 13, 2022 10:05
Although str and bytes act as sequences in Python, they do not count
as arrays according to OpenAPI, so we should not allow them to
validate as arrays.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@p1c2u
Copy link
Collaborator

p1c2u commented Sep 13, 2022

@andersk thank you for the contribution.

@p1c2u p1c2u merged commit 5553fe4 into python-openapi:master Sep 13, 2022
@andersk andersk deleted the array-cast branch September 13, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants