-
Notifications
You must be signed in to change notification settings - Fork 739
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
CompositeType parameters incorrectly being marked as constants #819
Comments
For the record, this created this issue in the Python SDK: |
We need a fix for this issue pretty soon @devigned and @yugangw-msft . |
@annatisch - That is a correct fix. I have verified this fix with Azure.NodeJS on the network spec as well. After applying your fix the generated code looked better. CompositeTypes were not being marked as constant where they shouldn't be. Please send a PR, and possibly a test in the modeler over here to make sure that this does not regress. |
Aww but the Python 'and' is so much more elegant than the C# '&&'... ;P |
I agree. I used to write in Perl and loved that elegance. However this is still better than PowersHell -gt, -lt, -eq :) |
cf2fdb5 Adding publicIp sample, only mark sub-DAGs as non-prepare - the root DAG stay as preparer 1d5e9c1 improving comment as per review 25beef0 Addressing review comments [javadoc, simplfying the map iteration] cfbafd0 comment corrections ac633da Making DAG to work correctly to handle more cases 45c3d88 couple of javadoc fixes 57288f4 Merge pull request Azure#819 from jianghaolu/async 999fb18 Add retry for 404 GET 9c048fc Add a bunch of configs to RestClient 46a53cd Merge branch 'master' of github.com:Azure/azure-sdk-for-java into async 76e3ae9 Merge pull request Azure#832 from jianghaolu/restclient 7be25fe Merge commit '486acdc633c498d4335711e30817cc70faacc487' into restclient 04af976 Regenerate azure & azure.fluent fecda5c Move RestClient into azure runtime f84d8eb making dag::prepare to work for update 05105b4 Remove rest client from generic codegen bb4a917 Fixing the bug of trying to create created resources during update, adding better way to name gen resource names 1773d49 Add stage for base url 4a7b25e Remove required mapper adapter 738d121 use AZURE_GERMANY insteadof AZURE_GERMAN 6c8f63a ensuring trailing slash for urls c8db8d3 correcting environment name 0261a6e Adding few more Azure environments 5aac1fa Add applyAsync() bc57070 Basic prototyping of async in fluent git-subtree-dir: ClientRuntimes/Java git-subtree-split: cf2fdb582fb504ea5f772ed03cffb07662c8c626
Hi - I'm seeing some strange behavior where non-constant complex type parameters are being incorrectly described as constant.
As example can be seen when generating this swagger spec:
https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2015-06-15/swagger/network.json
In particular, the model NetworkInterfaceIPConfiguration has a complex parameter Subnet - subnet is being classified as "constant" when I can't see a reason that it should be (i.e. it's not a string enum of one value, nor are all of it's parameters constant).
I stepped through the code, and I see that things seem to be going wrong in AutoRest.Modeler.Swagger.ObjectBuilder - line 169. It seems that in this particular scenario, compositeType.ComposedProperties is empty, so the if statement passes and the model is marked as constant.
I can fix this particular issue by simply replacing the code with:
However I don't know what other implications this change may have, and the bigger problem seems to be why ComposedProperties was empty in the first place (which I didn't investigate)....
Anyways - I hope this helps! We have some customers who are affected by this issue due to how we handle constants in the Python generator. If this is determined to not be a bug, let me know and I can change the Python implementation to work around this scenario.
Thanks!
The text was updated successfully, but these errors were encountered: