createSchemaRegistryWithCommonTypes function

SchemaRegistry createSchemaRegistryWithCommonTypes()

Creates a SchemaRegistry pre-populated with the common types schema.

Implementation

SchemaRegistry createSchemaRegistryWithCommonTypes() {
  final commonTypesSchema = Schema.fromMap(
    jsonDecode(commonTypesSchemaJson) as Map<String, Object?>,
  );
  final registry = SchemaRegistry();
  registry.addSchema(Uri.parse(commonTypesSchemaId), commonTypesSchema);
  return registry;
}