Releases: xogroup/felicity
1.2.0 Release Notes
Summary
Adds support for Joi.object().pattern()
schema.
Also includes non-breaking code optimizations and documentation updates.
Changes
Joi.object().pattern()
Felicity now supports the Joi .pattern
syntax.
const schema = Joi.object().pattern(/^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/, Joi.object().keys({
id : Joi.string().guid().required(),
tags: Joi.array().items(Joi.string()).required()
})).min(2);
Felicity.example(schema);
/*
{
'fa7bfcB5-f5be-A5bd-F480-a5B59cF77FCC': {
id: '8075405c-5098-417d-b6e6-867ea005ed64',
tags: [ 'zsbwo642nakh907beam50zfr' ]
},
'{1F4A8f2b-9cae-de77-b0E7-1e7FE6547aEB}': {
id: '3d78f59f-ee8b-4925-a92c-679b2c24b20b',
tags: [ 'lanzexj98o7gxuj91i8loko6r' ]
}
}
*/
Steps to upgrade
No breaking changes were included in this version. Upgrades should not require changes to your code.
1.1.1 Release Notes
Summary
Enforces object-type Joi schema on .entityFor
and fixes .example
infinite-loop bug for Joi.number().min(1).max(1)
.
Changes
.entityFor
object-type requirement
JavaScript constructor functions only return objects upon new Instance()
instantiation. This patch introduces Joi schema type-checking to ensure that only object-type schema are provided to Felicity.entityFor(schema)
to match this type requirement.
Non-object type schema (like Joi.number()
) will result in a thrown Error Joi schema must describe an object for constructor functions
.
.example
infinite loop
When Joi.number().min(min).max(max)
was provided to Felicity.example(schema)
with equal min
and max
values, Felicity would enter an infinite loop expecting min < value && value < max
. Instead, .example
will now properly return the min
value instead of looping.
Steps to upgrade
No breaking changes were included in this version. Upgrades should not require changes to your code.
1.1.0 Release Notes
Summary
Implements new entityFor
option: strictInput
and utilizes extended version of Joi for date().format()
syntax.
Changes
strictInput
, defaults false
If set to true, all input will be validated, and only properties that pass validation will be utilized on the returned object. All others will be returned in nulled/emptied form as if there was no input for that field.
const schema = Joi.object().keys({
id: Joi.string().guid()
});
const input = {
id: '12345678' // not a valid GUID
};
const Document = Felicity.entityFor(schema);
const document = new Document(input); // { id: '12345678' }
const StrictDocument = Felicity.entityFor(schema, { config: { strictInput: true } });
const strictDocument = new StrictDocument(input); // { id: null }
joi-date-extensions
Extend Joi with joi-date-extensions to support Joi.date().format() syntax deprecated in Joi v10.
Steps to upgrade
No breaking changes were included in this version. Upgrades should not require changes to your code.
1.0.1 Release Notes
Summary
This release is driven purely by documentation updates. No source code or tests were harmed in the making of this version.
Non-breaking Changes
API.md was updated to remove the pre-release disclaimer.
1.0.0 Official Release
v1.0.0 1.0.0
Alpha Build from Travis CI #3
Setting up slack
Alpha Build from Travis CI #2
0.0.3 bumping version and forcing newer npm install on travis
Alpha Build from Travis CI
Version bumped this package to npm publish
properly.
Alpha Build
This is an integration build to try out Travis CI build chain.