You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since re.findall(rf"[^{DELIMITERS}]+", value) trims prefix and suffix _ characters while generating python property identifiers, 2+ schema properties on a single model that differ only by such underscores causes CLI generate and update commands to fail.
Given it would be problematic to carry through those untrimmed identifiers due to the semantic meaning of prefix and suffix _ on identifiers in python, it makes sense to have a fallback value to use like a title property or a configurable prefix.
Resulting error:
$ openapi-python-client generate --path schema-underscore-collision.yaml --fail-on-warning
Generating schema-underscore-collision-client
Error(s) encountered while generating, client was not created
black failed
reformatted schema_underscore_collision_client/api/__init__.py
reformatted schema_underscore_collision_client/__init__.py
reformatted schema_underscore_collision_client/types.py
error: cannot format schema_underscore_collision_client/models/get_response_200.py: cannot use --safe with this file; failed to parse source file AST: keyword argument repeated (<unknown>, line 55)
This could be caused by running Black with an older Python version that does not support new syntax used in your source file.
reformatted schema_underscore_collision_client/client.py
reformatted schema_underscore_collision_client/api/default/get.py
Oh no! 💥 💔 💥
5 files reformatted, 2 files left unchanged, 1 file failed to reformat.
Using an example schema-underscore-collision.yaml:
The problematic schema_underscore_collision_client/models/get_response_200.py file, reported error is in the from_dict method but to_dict also suffers from the ambiguity:
Originally predicted in #383 (comment)
Since
re.findall(rf"[^{DELIMITERS}]+", value)
trims prefix and suffix_
characters while generating python property identifiers, 2+ schema properties on a single model that differ only by such underscores causes CLIgenerate
andupdate
commands to fail.Given it would be problematic to carry through those untrimmed identifiers due to the semantic meaning of prefix and suffix
_
on identifiers in python, it makes sense to have a fallback value to use like atitle
property or a configurable prefix.Resulting error:
Using an example
schema-underscore-collision.yaml
:The problematic
schema_underscore_collision_client/models/get_response_200.py
file, reported error is in thefrom_dict
method butto_dict
also suffers from the ambiguity:Versions
3.7.12
0.11.1
The text was updated successfully, but these errors were encountered: