Metadata-Version: 2.1
Name: SmileValidation
Version: 1.1.0
Summary: Python3 Validation in another way
Home-page: https://github.com/sitthykun/smilevalidation
Author: Sitthykun LY
Author-email: ly.sitthykun@gmail.com
License: MIT License
Keywords: smilevalidation,smilevalidator,validation,validator
Platform: All
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# SmileValidation
![smilevalidator](https://user-images.githubusercontent.com/227092/83977155-7da56a00-a928-11ea-9f9b-66df0791a9c6.png)

Python3 Validation in another way

I hurt enough for validating those form's elements. Time to bring a new technique type.
It's gonna solve like this way:

## Validator class
That's core class of the tool.
It contains the validation element after added element into collect and it will valid the element by called isValid()

```
from Validator import Validator

# validition instance
v	= Validator()

## float validation
# add element with  
v.addElement(
    elementName= 'computer-quatity'
    , elementValue= 2
    , rule= TypeSchema().getFloat(
			require= True
			, max= 5
			, min= 1
			, negative= False
		)
)

## start validating
# true if every element is correct
if v.isValid():
    print(f'Everything is fine')
else:
    print(f'Error: {v.getError()}')

```
## Rule class
It is the collection of what we wanna validate to those element objects. What Rule will help validation class is, make it all reusable.

Example:
```
# sample
class Rule:

    def getQualityOne(self) -> dict:
        """

        :return:
        """
        return TypeSchema().getFloat(
                require= True
                , max= 5
                , min= 1
                , negative= False
        )
``` 
getQualityOne will replace previous one.

```
# sample with two elements
from Validator import Validator

# validition instance
v	= Validator()

## float validation
# add element with  
v.addElement(
    elementName= 'computer-quatity'
    , elementValue= 2
    , rule= Rule.getQualityOne()
)

v.addElement(
    elementName= 'tv-quatity'
    , elementValue= 4
    , rule= Rule.getQualityOne()
)

## start validating
# true if every element is correct
if v.isValid():
    print(f'Everything is fine')
else:
    print(f'Error: {v.getError()}')
```



