withDefaultSchemaDialect static method

Map<String, dynamic> withDefaultSchemaDialect(
  1. Map<String, dynamic> schema
)

Returns a copy of schema annotated with the default JSON Schema 2020-12 dialect ($schema) when it is an object-type schema that does not already declare a $schema. Free-form schemas that already carry a $schema, or non-object schema fragments, are returned unchanged.

Implementation

static Map<String, dynamic> withDefaultSchemaDialect(
    Map<String, dynamic> schema) {
  if (schema.containsKey(r'$schema')) return schema;
  return {r'$schema': jsonSchemaDialect2020_12, ...schema};
}