-
Notifications
You must be signed in to change notification settings - Fork 92
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
Code generation issue with enumeration encapsulated in restriction type #234
Comments
The first step to get this fixed is to add a unittest, or extend an existing one, with enough WSDL to trigger the issue. |
Pull request added: #235 |
Thanks for the excellent unit test. Clearly the restriction on length == 2 serves no purpose in this case, the base type already ensures that the string is a value enum value, and all enum values have a length of 2... but I assume you can't change the WSDL file, or that there are use cases where this might be useful (e.g. if some enum values had a different length, as a string...). I added a |
…234) The existing unittest list_restriction didn't catch that things actually compiled. So I removed it and extended the other unittests instead, to try and test all cases (restriction on enum, restriction on string, restriction on number of items in a list...) The actual bugfix involves the addition of a stringValue() method for enumeration types -- which also simplifies the serialize() code.
Fixed in commit 57e02fb Thanks again for the unittest! |
The enumeration class uses encapsulate the enum using the enum name Type.
The class has a getter/setter getType type(0 and setType().
When this enum is encapsulated into a restriction type for example then the generated setter method generates code which tries to check the range generating this code.
Here the restriction length is 2:
rangeOk = rangeOk && (value.value().length() == 2);
The code doesn't compile because value doesn't have a value method.
Maybe adding a value method to the enumeration class returning a string?
The text was updated successfully, but these errors were encountered: