https://github.com/elfsundae/mjextensionvalidation
Provides an opportunity of validating converted model objects for MJExtension.
https://github.com/elfsundae/mjextensionvalidation
dictionary ios json mjextension model objective-c validation
Last synced: about 2 months ago
JSON representation
Provides an opportunity of validating converted model objects for MJExtension.
- Host: GitHub
- URL: https://github.com/elfsundae/mjextensionvalidation
- Owner: ElfSundae
- License: mit
- Created: 2019-07-03T09:24:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-23T09:27:32.000Z (about 6 years ago)
- Last Synced: 2025-08-13T14:32:53.657Z (11 months ago)
- Topics: dictionary, ios, json, mjextension, model, objective-c, validation
- Language: Objective-C
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MJExtensionValidation
[](https://github.com/ElfSundae/MJExtensionValidation/actions?query=workflow%3ABuild)


MJExtensionValidation provides an opportunity of validating converted model objects for [MJExtension] (A fast, convenient and nonintrusive conversion framework between JSON and model).
为 [MJExtension] 的 JSON-to-Model 转换增加校验接口。
## Installation
```ruby
pod 'MJExtensionValidation'
```
## Usage
Implement `+mj_validateConvertedObject:withKeyValues:` method for your model to validate the converted object:
```objc
#import
@implementation User
+ (BOOL)mj_validateConvertedObject:(User *)user withKeyValues:(id)keyValues
{
return user.ID.length > 0;
}
@end
```
Then the JSON-to-model converting methods such as `+mj_objectWithKeyValues:` will return `nil` if the converted object could not pass the validation.
## License
MJExtensionValidation is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
[mjextension]: https://github.com/CoderMJLee/MJExtension