-
Notifications
You must be signed in to change notification settings - Fork 6
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
Single quotes in example values breaks auto-generated test cases #112
Comments
@fullcircle23 The API returns the values with quotes like Could you please test if the Python generator does not complain if you wrap the affected examples with double quotes? Example:
|
Thanks @dgarcia360. I'll test wrapping the affected examples with double quotes. Btw, which API "returns the values with quotes"? |
@fullcircle23 |
@dgarcia360 Wrapping with double quotes worked on my local environment but not on travis. On travis (trusty), the openapi generator for python converted the double quotes to single quotes yielding incorrect syntax, for example: Following are the same versions in both my local env and in travis:
Following are different: OS
pyenv
Spent a whole day on this including setting up my laptop with pyenv to have matching python versions and various other config changes but not getting very far. There's a related openapi-generator [BUG][PYTHON] Single quotes not escaped Anyway, it seems like a bug still, probably related to the environment. So I've sent a request to travis-ci support to activate debug mode for the repository. Meanwhile, I'm going to switch back to stripping the single quotes from those values in the |
I've managed to replicate the results in travis on my local env after fixing some issues in my local java environment. So I can confirm that string values with single quotes that are wrapped in double quotes ends up being wrapped in single quotes in the generated test files. I've found a bug in |
I've fixed this issue in OpenAPITools/openapi-generator. |
OpenAPI Generator for Python auto-generates fully formed test cases in Travis-CI. These tests revealed possible issues and/or room for improvements in the OpenAPI spec.
The first type of issue that broke several tests with
invalid syntax
error are the single quotes in example values. Screenshot of the errors (sample) in travis job log below or view the raw log.Examples of the OpenAPI spec that caused the error:
Example 1:
maxTransactionsPerAggregate:
type: string
description: Maximum number of transactions per aggregate.
example: 1'000
Example 2:
currencyMosaicId:
type: string
description: Mosaic id used as primary chain currency.
example: 0x621E'C5B4'0385'6FC2
The fix is to remove the single quotes in the example values.
1.) 1'000 is replaced with 1000
2.) 0x621E'C5B4'0385'6FC2 is replaced with 0x621EC5B403856FC2
Altogether, the
invalid syntax
errors were found in 12 test cases and the corresponding values (with some repeats) are as follows:As a workaround, I've added a script in existing download-and-patch.sh to fix the above values. I've also attached the openapi yml with and without the single quote fix patch for comparison:
openapi3-any-of-patch.yml.txt
openapi3-any-of-patch-single-quote-patch.yml.txt
@dgarcia360 I can also fix the above values in the spec files in this repo and remove the workaround patch. Please let me know.
I'm also looking into the other failed test cases.
The text was updated successfully, but these errors were encountered: