FileHelpers icon indicating copy to clipboard operation
FileHelpers copied to clipboard

Add Support For Custom Field Validation

Open jbparker opened this issue 10 years ago • 6 comments

Hey @MarcosMeli Let me know if this is what you had in mind for the base validation - I ported the implementation of FieldValidateIsNotEmpty to this (in addition to renaming it).

I didn't create documentation for the above yet to verify that you were good with the changes - I can do this afterwards.

Also, I changed the naming of FieldNotEmptyAttribute to FieldValidateIsNotEmptyAttribute, which seems a bit long and nearly used a "FieldValidate" namespace for this, but wanted to see what you thought about all of that first. Small detail but just wanted to point it out.

jbparker avatar Mar 29 '15 02:03 jbparker

Also added IFieldValidate so that classes that implement can pass this at runtime into Engine.Options.Fields[].Validators.

jbparker avatar Mar 30 '15 13:03 jbparker

Last of changes for now - changed the access modifiers for fields that can be accessed via Engine.Options.Fields[].

jbparker avatar Mar 30 '15 19:03 jbparker

Great work :) !! (I was a out for some days)

I'm just thinking about to create a 4.0 branch and merge these changes there, also remove the FieldIsNotEmpty from the 3.0 branch, so we can move forward for a 3.0 release and work in validation for 4.0, and we can pulish the feature, mostly because it has a read centric aproach and we need to define if them will be read validations or apply on write too

What do you think ? Cheers

MarcosMeli avatar Apr 03 '15 16:04 MarcosMeli

Hey @MarcosMeli That works with me!

jbparker avatar Apr 03 '15 19:04 jbparker

@jbparker Hi There, sorry the long delay, i just merged your master branch to the jbparker-validation branch here:

https://github.com/MarcosMeli/FileHelpers/tree/jbparker-validation

Can you validate if I miss something, I get a ton of merge conflicts, maybe you need to add some test to the csproj

After we are sure that all works, we can start adding Validators and when done we will merge the changes to the 4.0 branch

Thanks

MarcosMeli avatar Jul 26 '15 00:07 MarcosMeli

Hey @MarcosMeli - sorry for the long delay with this, just getting back to this project.

I was able to go back in and merge MarcosMeli/FileHelpers/master into my fork (jbparker/FileHelpers) - I did that because I noticed a few things changing that shouldn't have changed.

That said, I still had to go back and change the following files to have Unix style line endings so that the diff would show properly for the PR:

  • FileHelpers/Dynamic/FieldBuilder.cs
  • FileHelpers/Fields/FieldBase.cs
  • FileHelpers/FileHelpers.csproj
  • FileHelpers.Tests/Data/GenerateTestData.autogen.cs
  • FileHelpers.Tests/FileHelpers.Tests.csproj

Additionally, I made a few other small changes to get VS NUnit runner to work (regarding execution location) that I think will be beneficial for others.

Can you take a look and see if the changes still look good?

I'm definitely still down to make documentation changes - let me know if it I should do them on this PR or on another.

Thanks!

jbparker avatar May 02 '16 21:05 jbparker