-
Notifications
You must be signed in to change notification settings - Fork 175
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
Validation Constraints on Optional Properties are enforced #146
Comments
So, I may have picked out the wrong method as the problematic one above: There, it makes it seem that if you don't provide values for |
Hey @tombuildsstuff, do you happen to able to point me at some code that already has this trouble? As far as I can tell, it shouldn't do validation on |
👋 Thanks for looking into this @marstr
I spent some time trying to put together some sample code to replicate this outside of the main repo and couldn't - so I took a fresh look at the code:
When I'd noticed the error (I was checking for the variables presence - but not to ensure it's not the default value) - I patched it to handle that and all is well:
🤦 Apologies for wasting your time on user error 😞. As such I think we can shut this issue? Having said that - the other issue in the Rest API Specs Repo still stands - in that it's not possible to set the Thanks! |
No worries, @tombuildsstuff! It was a good exercise for me to run through, definitely not a waste. As you mention, I'll close this issue out for now. However, conditional parameters and validation do seem to be a problem. I'm going to meditate on that problem for a while and will file a bug if I think of anything actionable that we can do to improve our Swaggers or the runtime. |
As noted by @tombuildsstuff in Azure/azure-rest-api-specs#1324, when an optional parameter has a constraint, that constraint shouldn't be enforced when the value isn't provided at all.
I've tracked down this issue to here: https://github.com/Azure/go-autorest/blob/master/autorest/validation/validation.go#L105
I'm working on a solution now.
The text was updated successfully, but these errors were encountered: