ptiz / bender Goto Github PK
View Code? Open in Web Editor NEWJSON validating and binding for Swift
License: MIT License
JSON validating and binding for Swift
License: MIT License
It would be helpful if there will be a possibility to pass multiple paths for one field.
Swift Package Manager might become mainstream to manage 3rd party dependencies and it would be better to add support for Bender
JSON Schema includes a few keywords for combining schemas together. There are special operators for it: 'allOf', 'anyOf', 'oneOf'. Need to add the similar features to Bender.
I.e.
public protocol Rule {
associatedtype V
func validate(_ jsonValue: AnyObject) throws -> V
func dump(_ value: V) throws -> AnyObject
}
There is an json object with "bottomLevelKey" = null.
Actual behavior of validation using testRule described below: validation fails.
Expected behavior: validation finishes successfully because testRule contains only .optional parameters.
let testRule = ClassRule(YourModel()).optional("topLevelKey", rule(StringRule, atPath: "bottomLevelKey")) { $0.value = $1 }
According to http://json-schema.org/latest/json-schema-validation.html there is the list of used validation categories for JSON (already supported items are marked โ):
Bender may support all of them by default. If something cannot be added into framework for any reasons need to implement examples of its usage.
Please add support of the Swift 5.1
JSON Patch has specific notation, amount of the different operations is limited. Special Bender rules/another mechanism for applying PATCH operations to model objects will be helpful.
Like this:
let passString = try! StringifiedJSONRule(nestedRule: passportRule).dump(pass) as! String
expect(passString).to(equal("{\"valid\":false,\"issuedBy\":\"One\",\"number\":null}"))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.