-
-
Notifications
You must be signed in to change notification settings - Fork 48
Milestone
Description
Currently we have only two strategies of validating schema:
strict- all fields must be exactly the sameselective- ignore extra fields addded to given that are not present in expected, otherwise the same asstrict
The goal is to add third option that will be aligned with a seamless schema evolution.
Here are the rules:
- if schemas are the same, return true
- if given schema has less fields than expected schema, return false
- if given schema is making a nullable field non-nullable, return false
- if given schema is making a non-nullable field nullable, return true
- if given schema is changing the type of a field, return false
- if given schema is adding a field, return true
There should be also dsl function:
schema_validate(Schema $expected, Schema $given, SchemaValidator = new StrictSchemaValidator()) : bool;
Additionally (it's a small bc break) we should change the order of argumetns in SchemaValidator::isValid()
Now:
- `isValid(Schema $given, Schema $expected) : bool;
Should be
isValid(Schema $expected, Schema $given) : bool
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done