A frequent piece of feedback I get when changing a Swagger spec is that I'm not documenting min/max length and regex rules for certain string properties such as resource names. I should do this for documentation purposes, but I don't.
The reason I don't include regex constraints and the like is because AutoRest uses them to generate client-side validation code, which I don't want. It introduces too much coupling between the client and the service and makes versioning more painful for practically zero benefit. I expand more on this line of reasoning in the discussion in this PR.
Client-side validation can make sense in the context of a UI where round-trip time is important and you need to preserve the user's work, but in the context of a library that directly calls a REST API it makes little sense.
We use auto generated sdk's for integration testing, the client side validation prevents us from writing a lot negative test cases.
@brjohnstmsft @tailo A configuration point to disable client side validation in C# should be in the latest nightly, see https://github.com/olydis/autorest/blob/master/Samples/1d-common-settings/readme.md (specifically client-side-validation: false) for an example. As we will move away from the legacy CLI, I haven't tested the switch there, but if I'm not mistaken it should be usable as -ClientSideValidation false.
Let me know if you have any questions, whether I have missed tying some validation to that flag or if something doesn't work! 馃檪
reopening to tag the languages I haven't touched (not even sure if they have client side validation in the first place)
To the language owners I've tagged: Please check whether your language supports client side validation.
If so, please imitate C#'s behavior of respecting the flag mentioned above (Settings.Instance.Host.GetValue<bool?>("client-side-validation") should get you the setting wherever you need it). If not, I assume that your customers never requested client side validation in the first place and you're off the hook.
Note that allowing to disable validation was done in C# due to strong customer feedback and the fact that it actually contradicts the Swagger spec (that says that constraints are enforced by the server side). By default, AutoRest core sets this setting to true to maintain backwards compatibility.
Now supported on Go
@olydis @fearthecowboy duplicate of https://github.com/Azure/autorest/issues/1583?
lol, indeed, closed the other one since there seems to be more traction on this issue here :D
Will be released in autorest.python 2.0.15. Needs msrest >= 0.4.15 to work (will be just ignored if < 0.4.15, will not crash).
With PRs https://github.com/Azure/azure-sdk-for-ruby/pull/1119 and https://github.com/Azure/autorest.ruby/pull/16 Ruby has added conditions that validations will not happen if the client side validation is set to false. Let me know if there is anything else to do on our side
Also changing the node assignment from @balajikris to @amarzavery
Any update when this will be done for the typescript version?
@RikkiGibson for TS
tracking in Azure/autorest.typescript#243
@RikkiGibson any eta for TS?