Skip to content

Add the validator attribute, validation rule and validator#133

Closed
xuzhg wants to merge 1 commit into
microsoft:masterfrom
xuzhg:Validation2
Closed

Add the validator attribute, validation rule and validator#133
xuzhg wants to merge 1 commit into
microsoft:masterfrom
xuzhg:Validation2

Conversation

@xuzhg

@xuzhg xuzhg commented Dec 13, 2017

Copy link
Copy Markdown
Contributor

@PerthCharern @darrelmiller
I want to implement the validation logic for the Open API element. Here's my design (it's not finished).
General design:
Can validation each part individually. for example, Developer create a object, he can call the validate api to validate the created object.
Validate rule can be customized. For example, developer can create their own validation rules.
Detail:
OpenApiElementValidator.cs has the public apis
.\Validations\Validator has the validator classes for each element.
.\Validations\Rules has the rule classes for each element.
Each model class has an attribute to identify the validator.

Please have a look and give me some feedback.

@darrelmiller

Copy link
Copy Markdown
Member

How is this branch different than the other validation branch? Are they alternative approaches, or complementary?

Can you explain why there is a need to introduce attributes? Personally I am of the opinion that we overuse attributes in .net libraries. What is the benefit they bring in this case?

@xuzhg

xuzhg commented Dec 13, 2017

Copy link
Copy Markdown
Contributor Author

@darrelmiller

#125 and #133 are the same purpose, but with different methods. I just want to use these two PRs to present my thinking about how to do validation for the DOM classes in my mind.

The general goal is to make the validation easy, easy to add, easy to customize.

@PerthCharern

Copy link
Copy Markdown
Contributor

Given that both #125 and #133 are both equally extensible, I would go with #125 since it's easier to understand and maintain. I'll go ahead and make specific comments in #125.

@xuzhg

xuzhg commented Dec 15, 2017

Copy link
Copy Markdown
Contributor Author

Close this because we are moving to #152.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants