json_codable 0.3.0
json_codable: ^0.3.0 copied to clipboard
JSON parsing, validation, and schema generation.
0.3.0 #
- Breaking: name getters after Dart types:
integer,floatandbooleanbecomeint,doubleandbool(json.int('age')), andJsonType.integer,float,numberandbooleanbecomeJsonType.int,double,numandbool. AddnumandnumOrNull. - Breaking:
list,listOrNull,mapandmapOrNulltake the item type as aJsonTypeinstead ofmapperandrules:json.list('ids', .int),json.list('users', .object(UserDto.fromJson)). - Breaking:
ValidationRule.rangeis generic, andintanddoubletakeValidationRule<int>andValidationRule<double>rules. - Breaking: type errors name types like JSON Schema in both
expectedandactual:string,integer,number,boolean,array,object,null. - Breaking: list item errors are reported at the item path (
tags.1), not at the list. - Breaking: remove
ValidationRulesExtensions.validate. - Breaking: rename error codes
invalid_enumtoenumandinvalid_discriminatortodiscriminator, matching the other codes. - Add
JsonTypeto describe how a field is decoded, validated and described in a schema, withwhere,convertandorNullto derive custom types, andJsonObject.readandreadOrNullto read them. - Add
JsonType.discriminatedfor polymorphic list items and map values. - Add
JsonSource.textto convert string values, such as query parameters, to the requested type. parsereports field errors instead of rethrowing when a mapper throws on the placeholder values of failed fields.ValidationErrorsthrown by mappers are reported at the object path.parseinside a mapper joins the enclosing parse, keeping error paths.- Fix
list<double>rejecting whole numbers.
0.2.1 #
- Fix schema generation for nested and collection fields (
list,object,map) usingdiscriminated. - Add OpenAPI
discriminatorproperty to schemas containingoneOf.
0.2.0 #
- Flatten
ValidationErrorsrepresentation using dot-notation keys (e.g.address.zip,items.0.title). - Add
keysgetter toJsonObject. - Add
ValidationError.fromJsonandValidationErrors.fromJsonfactories.
0.1.0 #
- Initial version.