-
Notifications
You must be signed in to change notification settings - Fork 218
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
Fix parse_source_type_name #635
base: master
Are you sure you want to change the base?
Fix parse_source_type_name #635
Conversation
88d84cd
to
6ebbbd2
Compare
Ping me once the tests are done |
Hello, I added some documentation, I would say that it is enough. Concerning the tests, I can't just add many simple unit tests as easily as before since the function I just need to find out why the tests are failing, this is not normal since I almost changed nothing since the last time, and it works locally |
21bad92
to
37cbbdd
Compare
It was just the merge that was not performed correctly, now it should be fine |
src/betterproto/plugin/models.py
Outdated
py_k_type: Type = None | ||
py_v_type: Type = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to pass type checking
{%- for enum in output_file.enums -%} | ||
{% for _, enum in output_file.enums|dictsort(by="key") %} | ||
"{{ enum.py_name }}", | ||
{%- endfor -%} | ||
{%- for message in output_file.messages -%} | ||
{% for _, message in output_file.messages|dictsort(by="key") %} | ||
"{{ message.py_name }}", | ||
{%- endfor -%} | ||
{%- for service in output_file.services -%} | ||
{% for _, service in output_file.services|dictsort(by="key") %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come these are being sorted now?
Summary
Fix #562 , #437
The function
parse_source_type_name
used to rely on an ad-hoc regex to work. The function failed when the package name had capital letters, since it believed that the package was actually a message.Now, the function goes through the packages and the messages that are actually defined (no more guess) to find the right one.
I also did some small refactoring of
models.py
:FieldCompiler
used to inherit fromMessageCompiler
, which made no sense.The PR still lacks tests and some doc, but since it can take a while to write, I first wanted to have your point of view on this.
NOTE: I completely deleted
test_gen_ref_type.py
for now, but I plan to replace it once you agree with the content of the PRChecklist