Skip to content

fix: Prevent backslashes in descriptions from breaking docstrings [#735]. Thanks @robertschweizer & @bryan-hunt! #735

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

Conversation

robertschweizer
Copy link
Contributor

We ran into Python parsing errors because we used backslashes in some description strings.

@robertschweizer robertschweizer force-pushed the fix-special-characters branch from 9cd6692 to a1cf1f4 Compare March 15, 2023 15:53
@bryan-hunt
Copy link

+1

I just encountered this issue consuming a published API and was going to submit the same patch.

Here is an example definition that triggers the issue: Modified Petstore

@codecov
Copy link

codecov bot commented Mar 18, 2023

Codecov Report

Merging #735 (5ef1281) into main (302cd02) will not change coverage.
The diff coverage is n/a.

❗ Current head 5ef1281 differs from pull request most recent head 139c186. Consider uploading reports for the commit 139c186 to get more accurate results

@@            Coverage Diff            @@
##              main      #735   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           49        49           
  Lines         1971      1971           
=========================================
  Hits          1971      1971           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dbanty dbanty enabled auto-merge March 18, 2023 22:34
@dbanty
Copy link
Collaborator

dbanty commented Mar 18, 2023

Thanks for this, I did tweak it so that the diffs will be smaller for folks updating. PEP 257 seems to indicate that a docstring containing a \ is the only case where the r prefix is necessary. If there are more edge cases we may need to go back to all-raw docstrings, but I figure I should try to reduce diffs for folks.

@dbanty dbanty changed the title fix: Prevent special characters in descriptions from breaking docstrings fix: Prevent backslashes in descriptions from breaking docstrings [#735]. Thanks @robertschweizer & @bryan-hunt! Mar 18, 2023
@dbanty dbanty disabled auto-merge March 18, 2023 22:40
@dbanty dbanty merged commit ae45fb5 into openapi-generators:main Mar 18, 2023
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.

3 participants