XeroAPI.Net icon indicating copy to clipboard operation
XeroAPI.Net copied to clipboard

Client Side Validation

Open MatthewSteeples opened this issue 12 years ago • 4 comments

We'd like to save ourselves a request to the server and ensure that our data is valid before trying to upload it. We're happy to contribute our changes back to this library as and when we do it if you're interested in taking them?

If you're interested then I'll let you know what my design looks like so far and we can take it from there.

MatthewSteeples avatar Jul 10 '12 18:07 MatthewSteeples

Forgot to mention as well, if it would be possible to obtain any of the routines (either real code or just criteria) that the API performs for inclusion here that would be great. Obviously I understand completely if not.

MatthewSteeples avatar Jul 10 '12 18:07 MatthewSteeples

This is a interesting request.

A lot of the server-side validation is based around the core accounting engine. There are literally thousands of rules that are wired into the whole system. A certain proportion are also dependent on the current organisation (e.g. small/medium/large, current tax rates, active accounts). Writing just the common validation rules into the client side library could take a few months to get something half decent working.

It's unlikely that we'd spend much time on this sort of project, as it only serves the percentage of API developers that write in the .Net environment. There are also still lots of features to be added into the Xero API itself that would take priority.

Saying that, you're welcome to write in any validation rules into the XeroAPI.Net wrapper library yourself and submit pull requests for anything that benefits all users of the library. If you have a fork showing how you see this client-side validation working, I'd be keen to see what you've done.

Dan..

danbarratt avatar Jul 10 '12 22:07 danbarratt

Hi Dan,

Thanks for your feedback on this. I wasn't thinking of doing too many specific checks, just some "sanity checks" to see whether it's worth submitting the data. I've put together a dummy sample using LineItems which can be found at my fork of the project: https://github.com/MatthewSteeples/XeroAPI.Net. In particular you're looking at the following commit: https://github.com/MatthewSteeples/XeroAPI.Net/commit/1d3fa42259f9864bbcbd036b750651c7a4296edf.

Regards, Matthew

MatthewSteeples avatar Jul 14 '12 15:07 MatthewSteeples

Hi Dan,

Just to update you on this, I've got a basic client side validation library up and running and listed in nuget (if you're happy for it to stay there).

If you've got any questions about it then please let me know.

Regards, Matthew

MatthewSteeples avatar Sep 10 '12 13:09 MatthewSteeples