Alternative · target: json-schema-faker alternative

json-schema-faker Alternative for Orders API (single-schema generator comparison) Seed Data

User likes json-schema-faker but cannot get relational output or negative cases from it.

Direct answer

SchemaSeed reads the Orders API (single-schema generator comparison) schema and writes loadable rows; json-schema-faker generates values for one document, with no SQL and no invalid instances. The gap appears with cross-table references.

That gap only matters once the fixture has two or more tables that reference each other, or once a test suite must assert the API rejects malformed input; for one flat schema json-schema-faker is usually sufficient.

The same Orders API (single-schema generator comparison) schema run through json-schema-faker yields a JSON document whose refunds.order_id reference values that match no parent row; the reference engine rejected that shape with "FOREIGN KEY constraint failed".

Data as of 2026-11-18 · source: 1 Stack Overflow questions, json-schema-faker at 4,376,957 monthly downloads · negative-case messages reproduced by executing the fixture against a local SQL engine (Node.js v24.22.0, engine 3.53.4) at 2026-11-18T11:53:54.233Z

What the incumbent does well — Orders API

json-schema-faker is a mature tool and it is not going away. For a single flat schema it produces valid JSON faster than anything else, and its API surface is small enough to learn in an afternoon. If your Orders API (single-schema generator comparison) fixture is one table with no cross-table references, the honest answer is that json-schema-faker is enough and this page will not change your mind.

The gap that matters for relational seeds

The gap appears the moment the fixture stops being one table. json-schema-faker reads one schema and produces one document; it has no second schema to read, so it cannot know that refunds.order_id must point at a row in orders. The result is values that are individually plausible and collectively unloadable. The reference engine rejected exactly that shape with "FOREIGN KEY constraint failed".

Side by side on the same fixture

The table below scores the two approaches against the identical Orders API (single-schema generator comparison) fixture. The rows are not opinions about architecture; each one is a property of the fixture that the reference engine can verify. The decisive row is the foreign key row, because a JSON document can carry a dangling reference without any tool complaining until the moment it is loaded.

Migrating an existing fixture

You do not have to rewrite your fixture. Keep the schema file, run the generator against it, and diff the output against the rows you already have. For Orders API (single-schema generator comparison) the diff is usually small: 2 tables, and the changes are the constrained columns, which are the ones a hand-written seed gets wrong most often. The negative case set is additive, so nothing you already depend on is lost.

How to decide in under a minute

Two questions decide it. Does your schema have more than one table that reference each other? Does your test suite need to prove the API rejects malformed input? If both answers are no, stay on json-schema-faker. If either is yes, the missing piece is the same in both cases: a generator that reads the whole document and treats the constraints as part of the contract rather than as decoration.

SchemaSeed vs json-schema-faker on the Orders API (single-schema generator comparison) fixtureEight criteria, each decided by a property of the fixture rather than by preference. The left column is what a schema-to-SQL generator does with it; the right column is what document generation leaves unresolved.
CriterionSchemaSeedjson-schema-fakerWhat decided it
Reads a multi-file OpenAPI documentyesyesboth resolve local $ref chains
Honours NOT NULLyespartialboth read the required array
Honours enum, range and length declarationsyespartialthe fixture declares orders.amount with "amount" >= 0; the declaration is read out of the schema, the DDL carries it as a CHECK constraint and the value that breaks it ships as a negative case
Honours enum membersyesyesthe enum array is copied verbatim
Produces SQL, not just JSONyesnooutput format is the difference
Resolves foreign keys across schemasyesnothe fixture has refunds.order_id pointing at orders, and the second tool never reads that table
Emits deliberately invalid instancesyesnonegative cases are a separate output
Same seed produces the same bytesyesyesboth are seedable
Real constraint failures for the Orders API (single-schema generator comparison) fixtureReproduced by executing the fixture against a local SQL engine (Node.js v24.22.0, engine 3.53.4) on 2026-11-18T11:53:54.233Z. The message column is verbatim engine output; the SQLSTATE column is the PostgreSQL error class for the same constraint class.
Failure classColumnSQLSTATEError nameEngine message (verbatim)
Missing required fieldorders.customer_email23502not_null_violationNOT NULL constraint failed: orders.customer_email
Out-of-contract valueorders.amount23514check_violationCHECK constraint failed: orders_amount_check
Dangling foreign keyrefunds.order_id23503foreign_key_violationFOREIGN KEY constraint failed
The four checks that decide whether a schema tool is enough for Orders API (single-schema generator comparison)Applied to Orders API (single-schema generator comparison).
CheckResult on this fixtureConsequence
More than one table references anotheryes — refunds → ordersthe generator must resolve cross-table references
Output has to be SQL, not JSONyes — the target is PostgreSQLa document generator produces the wrong artefact
Tests must assert the API rejects bad inputyes — a negative case for every declaration in the schemanegative instances have to be generated separately
Same seed must reproduce the same bytesyes — seed 42 is fixedfixtures can be committed and diffed
seed.sql

npx --yes @wenlu8848/schemaseed generate --input ./alt_orders.openapi.yaml --out ./seed --formats sql --count 10 --seed 42

Download alt_orders.openapi.yaml

-- Generated by schemaseed.
-- seed: 42
-- rows per table: 10
-- Foreign key values are taken from the rows of the referenced table.

BEGIN;

CREATE TABLE IF NOT EXISTS "orders" (
  "id" UUID,
  "customer_email" TEXT NOT NULL,
  "status" TEXT NOT NULL,
  "amount" INTEGER NOT NULL,
  CONSTRAINT "orders_pkey" PRIMARY KEY ("id"),
  CONSTRAINT "orders_status_check" CHECK ("status" IN ('placed', 'paid', 'shipped')),
  CONSTRAINT "orders_amount_check" CHECK ("amount" >= 0)
);

CREATE TABLE IF NOT EXISTS "refunds" (
  "id" UUID,
  "order_id" UUID NOT NULL,
  "amount" INTEGER NOT NULL,
  "reason" TEXT NOT NULL,
  CONSTRAINT "refunds_pkey" PRIMARY KEY ("id"),
  CONSTRAINT "refunds_amount_check" CHECK ("amount" >= 1)
);

DO $schema_seed$
BEGIN
  IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'refunds_order_id_fkey') THEN
    ALTER TABLE "refunds" ADD CONSTRAINT "refunds_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "orders" ("id");
  END IF;
END
$schema_seed$;


INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('fca703d1-9e25-450e-b57d-c3771178e8c1', 'omar.okafor669@test.dev', 'placed', 474)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('2a7c2149-b84e-4317-a47b-d70dd75c9ee9', 'quinn.engel704@example.com', 'placed', 872)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('3a357283-6d2c-4d5d-90d3-e605d663e7dd', 'quinn.jansen784@example.org', 'placed', 204)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('9051547d-ce1a-41c6-a81d-cdb2c114968e', 'gus.ibarra760@test.dev', 'paid', 171)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('51c64f2b-7701-4601-91a1-dd777728d295', 'quinn.engel907@example.org', 'paid', 706)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('5708982b-9028-43d8-9a0b-7b88ddce5343', 'nia.moreau644@example.org', 'paid', 534)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('8a51e325-2dfc-4d6d-aea3-b4811d8a43a1', 'quinn.okafor306@mail.example', 'shipped', 675)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('dc168a50-6ccd-4c68-8c7e-6dbc7e79d5c1', 'eli.moreau986@example.net', 'shipped', 315)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('aefa9656-0e97-48e7-807b-c9c2d6befede', 'ada.novak38@example.com', 'placed', 92)
  ON CONFLICT DO NOTHING;
INSERT INTO "orders" ("id", "customer_email", "status", "amount")
  VALUES ('fdec7aee-b1a2-4f8b-8763-f1cdd022a113', 'fay.duarte96@example.com', 'paid', 393)
  ON CONFLICT DO NOTHING;

INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('aa0b8bb2-a845-490d-8584-14f15a13c58b', 'dc168a50-6ccd-4c68-8c7e-6dbc7e79d5c1', 91, 'meadow cedar')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('a35db25b-ca4a-4073-9b7c-6d0e17bbf9af', '8a51e325-2dfc-4d6d-aea3-b4811d8a43a1', 332, 'Bao Jansen')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('45ccabb2-74f7-4b9f-b4e2-61111d32bf0a', 'fdec7aee-b1a2-4f8b-8763-f1cdd022a113', 910, 'grove indigo')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('cbe7fa16-e8d5-463f-8421-154a8a4d23f7', 'aefa9656-0e97-48e7-807b-c9c2d6befede', 103, 'dara.kaur@test.dev')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('f7076686-38c5-480d-b54a-4e8ce2f8eed1', '3a357283-6d2c-4d5d-90d3-e605d663e7dd', 23, 'bao.petrov@mail.example')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('a27611d1-80eb-4c06-8add-fbe982fe93f7', 'fdec7aee-b1a2-4f8b-8763-f1cdd022a113', 835, 'Chen Bianchi')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('183bf772-6a85-497f-b4e1-2f048a8d850e', '8a51e325-2dfc-4d6d-aea3-b4811d8a43a1', 324, 'ada.lund@example.org')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('34b50b20-703d-49ad-89f1-9fc563d5848c', '9051547d-ce1a-41c6-a81d-cdb2c114968e', 759, 'grove tundra')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('88200ba2-0a10-45ab-bc2b-58650cdaa83e', '2a7c2149-b84e-4317-a47b-d70dd75c9ee9', 140, 'Toronto, Harbor Road 229')
  ON CONFLICT DO NOTHING;
INSERT INTO "refunds" ("id", "order_id", "amount", "reason")
  VALUES ('e4245f1f-7413-4777-b771-4184831bf3e7', '5708982b-9028-43d8-9a0b-7b88ddce5343', 363, 'Toronto, Elm Avenue 137')
  ON CONFLICT DO NOTHING;

COMMIT;

Frequently asked questions

Is json-schema-faker still worth using?
For one flat schema, yes. The gap opens on Orders API (single-schema generator comparison): json-schema-faker produces values for a single schema, while this fixture has 2 related tables that have to load together.
Can I keep the fixtures I already wrote?
Yes. Regenerate against the same Orders API (single-schema generator comparison) schema and diff. On this fixture only the constrained columns move, and the negative cases are additive.
Does SchemaSeed replace json-schema-faker entirely?
No. It is a different artefact: json-schema-faker produces values for one schema, SchemaSeed produces a PostgreSQL seed script plus invalid instances for 2 related tables.
Is there a paid version?
No. The CLI is MIT licensed and free: unlimited local generation, no account, no telemetry and no usage limit, and it runs on your own machine. Sponsorship is what keeps it maintained.

Run it against your own schema

SchemaSeed is MIT licensed and free: unlimited local generation, no account, no telemetry and no usage limit. It reads your schema file on your own machine, so nothing is uploaded anywhere. If it saves you time, you can support the project.

Get SchemaSeed — free Support the project

Questions: support@schemaseed.drz8848.win