-
Notifications
You must be signed in to change notification settings - Fork 426
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
[Python] Adding type-hinting for API responses #841
base: master
Are you sure you want to change the base?
Conversation
Hey @Dringho , why you closed this? Need any help? |
@HugoMario I was trying to improve the solution but I couldn't without delving into the Java, which was a mess to understand. My current problem it's that on the generated inline_response_200 response, if you have a nested structure, it references to answers like inline_response_200_message, but there was no way to add the import for it, so the type hinting would be enabled at the nested level. I was working on the
This is because of the SnakeCase vs CamelCase difference between the filename and the class name. Currently there is no way to get the snake_case name of the complex type. This is the JSON that was supplied to mustache
To fix this, it would be needed to add the "importPath" or "filename" key to the nested Array/Object schema objects, but that fix would require a better knowledge of the Java code that I don't currently have. Regardless this Pull Request helps the first level of type hinting so I reopened it. |
Would it be possible to already have a basic typehinting functionality for types like 'float', 'dict'... that just gives 'object' as a type hint instead of importing the more precise type? |
I'm not sure I understand your idea. Why would you type hint something broader than the actual return? With this PR the basic typehints work as well as the complex ones (except for the nested complex types) |
If I understand it correctly we have 4 possibilities how many typehint functionality to have (listed in increasing value):
I assume that the branch is not merged because getting 4) to work is quite complex. |
@Dringho Do you know why this PR is not approved? Does it need to be rebased on master or are there additional problems? |
@MalteEbner I do not know why this Pull request has not been reviewed/approved. I'm not sure about the development cylce of this project, I'm just an outside contributor. |
BUMP |
Can someone rebase this? Who wants to make some $$? |
Tested in Pycharm and vscode