validateJsonSchema function

List<String> validateJsonSchema(
  1. Object? value,
  2. Map<String, Object?> schema, {
  3. String path = r'$',
})

A validator for the JSON Schema subset app_intents_codegen:describe emits: type (a name or a list), enum, properties, required, additionalProperties: false, items, anyOf and format: date-time.

Anything else in a schema (title, x-entity, …) is ignored, so a schema with keywords this validator does not know never fails a value.

Implementation

List<String> validateJsonSchema(
  Object? value,
  Map<String, Object?> schema, {
  String path = r'$',
}) {
  final errors = <String>[];
  _validate(value, schema, path, errors);
  return errors;
}