renderSchemaFixtures function

Map<String, String> renderSchemaFixtures(
  1. List<SchemaFixtureSuite> suites
)

Renders a package's schema/ directory as relative path to contents.

The directory holds manifest.json, one <name>.schema.json per suite that owns a schema, and fixtures/<name>.json with the accept and reject documents. External validators such as Ajv read these files directly.

This stays free of dart:io so the testing library imports on every platform; a golden test writes or compares the returned files.

Implementation

Map<String, String> renderSchemaFixtures(List<SchemaFixtureSuite> suites) => {
  'manifest.json': _pretty({
    'suites': [for (final suite in suites) suite.manifestEntry],
  }),
  for (final suite in suites)
    if (suite.schema case final schema?) suite.schemaPath: _pretty(schema),
  for (final suite in suites)
    suite.fixturesPath: _pretty(suite.fixturesDocument),
};