membrane-php / membrane-core

Membrane is a general purpose input validation library, supports both PHP Attributes and OpenAPI specifications
Other
1 stars 2 forks source link

FixedFields validator added #73

Closed charjr closed 1 year ago

charjr commented 1 year ago

FixedFields(...$fields) validates that only fixed fields have been provided.

This is work towards the Object Builder handling when additionalProperties is set to false.

i.e.

$beforeChain = [];

...

if ($specification->additionalProperties === false) {
    $beforeChain[] = new FixedFields(...$specification->properties);
}

...

$beforeSet = new BeforeSet(...$beforeChain)