feO2x / Light.GuardClauses

A lightweight .NET library for expressive Guard Clauses.
MIT License
85 stars 8 forks source link

Extend validation methods for HTML and URL check #75

Closed Sacharkin closed 3 years ago

Sacharkin commented 3 years ago

Actually I start to use this framework to validate/guard my properties. But I do not finde a implementation to check HTML content or URLs, this would be nice. Prefer to use something like: value.MustBeHtml() value.MustBeUrl()

feO2x commented 3 years ago

Hey Sacharkin,

unfortunately, I have to disagree with you on the HTML assertion for the following reasons:

In general, if you have to parse something, then it's not a good fit for Light.GuardClauses. Just parse it and check if the corresponding parser throws an exception or reports any other kinds of errors.

Regarding the URL: there already are assertions that validate URIs. I would suggest you create an URI instance and then use one of the assertions.

Does this fit your needs?

feO2x commented 3 years ago

BTW, there already was a similar issue regarding JSON: https://github.com/feO2x/Light.GuardClauses/issues/68

Maybe you want to read it, too.

Sacharkin commented 3 years ago

I understand the reasons to not implements this issue. Can be closed. Thanks 👍🏻

feO2x commented 3 years ago

No worries! Thanks for your suggestions.