In schwifty v5 and below we currently define a model's schema on joiSchema and then are instructed to access it from getJoiSchema(). The only reason we did it that way was because static class properties didn't exist back in node v8: we had to make them all getters static get joiSchema(). And it just didn't make sense to recreate the joi schema every time Model.joiSchema is accessed through the getter, so getJoiSchema() was implemented to do this caching for us.
Now that we plan to support node v12+ we don't have to optimize for that kind of usage. You will define static joiSchema = Joi.object(/*...*/); and access Model.joiSchema directly. In order to support patch schemas formerly accessed with Model.getJoiSchema(true) we will implement a cached getter Model.joiSchemaPatch derived from Model.joiSchema.
In schwifty v5 and below we currently define a model's schema on
joiSchema
and then are instructed to access it fromgetJoiSchema()
. The only reason we did it that way was because static class properties didn't exist back in node v8: we had to make them all gettersstatic get joiSchema()
. And it just didn't make sense to recreate the joi schema every timeModel.joiSchema
is accessed through the getter, sogetJoiSchema()
was implemented to do this caching for us.Now that we plan to support node v12+ we don't have to optimize for that kind of usage. You will define
static joiSchema = Joi.object(/*...*/);
and accessModel.joiSchema
directly. In order to support patch schemas formerly accessed withModel.getJoiSchema(true)
we will implement a cached getterModel.joiSchemaPatch
derived fromModel.joiSchema
.