Repository navigation
[DRAFT] In house JsonSchema to TS generator - #1382
JuanGalilea wants to merge 21 commits into
Conversation
9c2467e to
1406406
Compare
024469a to
fd4d2f0
Compare
apify-factory
left a comment
There was a problem hiding this comment.
Good work, one thing to fix before merge.
🏭 Factory review — ℹ️ not auto-approved
This change was reviewed but cannot be auto-approved: a gate failed, so the review cannot end in an approval.
| check | result |
|---|---|
| Static gates | ❌ 8/16 — author-allowed, max-files, max-lines, file-extensions, deny-globs, patch-present, no-risky-content, pr-title |
| Review findings | ❌ not clean |
| Reviewer escalation | ❌ Replaces a dependency with a new in-house compiler and breaks the public CLI and generated-file contract (removes --strict/--all-optional, renames exported types from Input interfaces to lowercase input types, changes the KVS output shape). |
Juror 1 — claude-sonnet-5-5, adversarial |
⏭️ skipped — a gate failed |
Why it was not auto-approved
Failed gates:
author-allowed: JuanGalilea: not a member of apify/product-engineeringmax-files: 54 changed files, limit 10max-lines: 22661 changed lines (+21733/-928), limit 200file-extensions: disallowed extension: .vscode/settings.json, package.json, pnpm-lock.yaml, test/setup/output-schemas/valid.json, test/local/fixtures/lib/schema-to-ts/dataset/comment-scraper.json, test/local/fixtures/lib/schema-to-ts/dataset/google-places.json, test/local/fixtures/lib/schema-to-ts/dataset/tiktok-followers-scraper.json, test/local/fixtures/lib/schema-to-ts/input/api-scraper.json, test/local/fixtures/lib/schema-to-ts/input/comment-scraper.json, test/local/fixtures/lib/schema-to-ts/input/free-amazon-product-scraper.json, test/local/fixtures/lib/schema-to-ts/input/google-places.json, test/local/fixtures/lib/schema-to-ts/kitchen-sink.json, test/local/fixtures/lib/schema-to-ts/kvstore/maps-to-polygon.json, test/tsconfig.jsondeny-globs: package.json matches **/package.json; pnpm-lock.yaml matches **/pnpm-lock.yamlpatch-present: no text diff for test/local/fixtures/lib/schema-to-ts/expected/input/google-places.ts, test/local/fixtures/lib/schema-to-ts/input/google-places.jsonno-risky-content: test/local/lib/schema-to-ts/hash.test.ts: credential-like assignment (credential-assignment); test/local/lib/schema-to-ts/parser.test.ts: credential-like assignment (credential-assignment); test/local/lib/schema-to-ts/preprocess/input.test.ts: credential-like assignment (credential-assignment)pr-title: title "[DRAFT] In house JsonSchema to TS generator" must match type(scope): message
The comments above are the review itself; this section only explains the approval decision. Push a change and request @apify-factory again to re-run it, or ask a human to review.
Reviewed 99faebbca · workflow run
| label: 'output', | ||
| outputDir, | ||
| fileName: 'output.ts', | ||
| schema: outputSchema, |
There was a problem hiding this comment.
Important: the output schema now goes to compile raw, and the parser treats a missing type as an error that becomes unknown, so an output schema without a root "type": "object" (like the valid.json fixture before this PR had to add it) now generates export type output = unknown; and still exits 0. The deleted prepareOutputSchemaForCompilation (and the dataset/KVS preparers) defaulted type to 'object', so this is a regression for Actors that worked before; the same thing happens to dataset fields and KVS jsonSchema that leave out type.
base generator and tons of testing added.
actor generate-schema-typesInstall size change (
node scripts/report-install-size.mjs)AI
/show-mebelowReplaces the
json-schema-to-typescriptdependency with an in-house schema→TypeScript compiler (src/lib/schema-to-ts/, zero runtime deps — onlynode:crypto), and reframes the CLI flag surface around a single--perspective.The pipeline
Two orthogonal signals come out: diagnostics = fidelity lost (something became
unknown), notices = schema lint with no type impact. Neither feeds the hash.The
supplied/receivedsplit is the conceptual core — same IR, two renderings:Drift detection
canonical.tssorts props/enum members whileemit.tsreproduces authored order — so reordering keys in a schema never reports drift. Header is matched anywhere in the file (gm), so a user's prepended banner is free; two headers →duplicate-headererror.CLI surface change
Behavior changes worth a reviewer's attention
export interface Inputexport type input— lowercase, fromconst name = 'input'biome-ignore-all,eslint-disable,prettier-ignore-startfields→ skip with warningexport type dataset = Record<string, unknown>;prettierformatting via the libraryArray<T>, parenthesized intersections)