-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Smart Charging - SetChargingProfile object and data types #26
Conversation
Hello @LiorBenAri! This PR looks great, I just have a small issue with a part of it: OCPI.Net uses contract validators for validating the presense of properties instead of marking properties as required in the contract model. Normally, we define all contract properties as nullable and then use contract validators to check whether a property was null or not. This approach allows us to better distinguish between null vs default values (like 0 for numbers) in incoming data, and also allows us to better form validation error messages in case if some properties did not satisfy the protocol requirements. It also allows us to better validate things like arrays (at least one item present, etc.) and define other specific validation rules. Can we have this PR updated so that it would not define Here is some OCPI.Net documentation on this topic And Validators code is located under |
src/OCPI.Net.Contracts/ChargingProfiles/OcpiSetChargingProfileCommand.cs
Outdated
Show resolved
Hide resolved
Hi Yuri, Will edit as you requested. Lior |
I see that there isn't a validation logic for all of the library objects (for example Session\CDRs objects).
Lior |
@LiorBenAri Sure, it is not required to add validation logic right now, it can always be added later. Thank you for adding the contract models. Just make sure you have some other way in your project to check if those fields are present in the incoming data. Regarding Thank you for pointing out some other validators are missing, too. I will try to add those later if I can. The package is far from perfect and does require some work in order for it to become feature-complete. This looks great. I am merging this. |
Thank you Yuri. |
@YuriyDurov |
@LiorBenAri Yes it's published, the new package version is 0.16.2 and it contains these changes. And thank you for the kind words :) |
Thank you :) |
No description provided.