unevaluatedProperties property
bool?
get
unevaluatedProperties
Similar to additionalProperties but more flexible, see https://json-schema.org/understanding-json-schema/reference/object#unevaluatedproperties for more details.
For example, to define a schema where any property not explicitly defined
in properties
or matched by patternProperties
is disallowed:
final schema = ObjectSchema(
properties: {'name': Schema.string()},
patternProperties: {r'^x-': Schema.string()},
unevaluatedProperties: false,
);
In this schema, an object like {'name': 'John', 'x-id': '123'}
would be
valid, but {'name': 'John', 'age': 30}
would be invalid because age
is
neither a defined property nor matches the pattern, and
unevaluatedProperties
is set to false
.
Implementation
bool? get unevaluatedProperties => _value['unevaluatedProperties'] as bool?;