conjure-python icon indicating copy to clipboard operation
conjure-python copied to clipboard

Python constructor argument order is alphabetical

Open vipshek opened this issue 7 years ago • 3 comments

The generated constructor for a Conjure-defined object currently has its arguments ordered by optional vs. non-optional, followed by alphabetical order. This is defined here.

This seems to be out of sync with generated Java clients for Conjure objects, which have an .of() method whose argument order matches the order in the original Conjure YML definition. Is there a strong reason for this difference between the Java and Python clients?

vipshek avatar Nov 27 '18 22:11 vipshek

I would not compare the .of() factory method of some conjure-java beans with the constructor of the conjure-python "object" classes.

In Java, the .of() method is simply a convenience wrapper around the builder for beans with small number of arguments. In Python, the constructor is the equivalent of the Java builder and is the only way to create these objects.

I do agree though that the current ordering is not ideal. Long term we want to major rev the code gen and make all constructor and endpoint arguments kwargs for robustness (prevent binary breaks caused by backwards compatible API changes) and clarity

ferozco avatar Nov 28 '18 09:11 ferozco

@ferozco : Is this long-term change (making all constructor and endpoint arguments kwargs for robustness) still on your roadmap? I think that there is an argument to be made that this major rev can also come with dropping Python2 support (Python2 was sunset more than a year ago), which would make the implementation of enforcing mandatory keyword args a great deal simpler.

AaronJRubin avatar Feb 04 '21 08:02 AaronJRubin

Hey @AaronJRubin I've rolled off of the team and I don't believe there is any active development on Conjure-python right now. @carterkozak or @jkozlowski are the best people to ask

ferozco avatar Feb 04 '21 18:02 ferozco