[codex] Support PICT-compatible inline schema definitions#187
Conversation
|
Warning Review limit reached
More reviews will be available in 59 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds support for PICT-style inline schema definitions (name: rule) across the core parsing and rendering pipeline, allowing users to copy PICT schemas directly while still supporting the existing two-line format.
Changes:
- Extend schema parsing to accept inline
name: ruledefinitions and tag parsed schema tokens asinlinefor round-trip fidelity. - Update schema rendering to preserve inline formatting when schema tokens indicate an inline rule.
- Add regression tests (parser, schema adapter, generate/amend flows, and safe faker validation) and document the new syntax.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new inline name: rule schema form alongside the existing two-line format. |
| packages/core/src/tests/data_generation/unit/rulesParser.test.js | Adds parser coverage for inline definitions, inline round-trip rendering, and a non-inline colon edge case. |
| packages/core/src/tests/data_generation/schema-rules-adapter.test.js | Ensures inline tokens round-trip through schemaText/dataRules adapters. |
| packages/core/src/tests/core-api/generateFromTextSpec.test.js | Verifies generation + safe faker validation accept inline schema definitions. |
| packages/core/src/tests/core-api/amendFromTextSpecAndData.test.js | Verifies amend flows accept inline schema definitions. |
| packages/core/src/index.js | Updates safe-mode faker rule scanning to recognize inline schema definitions. |
| packages/core/js/data_generation/schema-conversion.js | Renders rules inline when schema tokens specify inline, using token separator when available. |
| packages/core/js/data_generation/rulesParser.js | Implements inline name: rule parsing and emits inline-aware schema tokens; updates token-based rendering for inline rules. |
| docs-src/docs/040-test-data/018-Schema-Definition.md | Adds user-facing docs for the inline PICT-style schema syntax. |
Greptile SummaryThis PR adds support for PICT-style inline schema definitions (
Confidence Score: 4/5Safe to merge; the core parsing and rendering paths are well-tested and the inline detection heuristic is conservative enough to avoid false positives in realistic schemas. The inline detection heuristic is duplicated verbatim across packages/core/src/index.js — the duplicated heuristic lives here alongside the rewritten Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Input line] --> B{blank or comment\nor constraint?}
B -- yes --> C[emit token, pendingName = null]
B -- no --> D{looksLikeInlineRuleSpec\nmatches after colon?}
D -- yes --> E[emit inline rule token\nkind=rule, inline=true]
D -- no --> F{pendingName set?}
F -- no --> G[pendingName = trimmed]
F -- yes --> H[emit two-line rule token\nkind=rule, inline=false]
E --> R[renderSpecFromRulesWithTokens]
H --> R
R --> I{token.inline = true?}
I -- yes --> J[output: name + separator + rule]
I -- no --> K[output: name line then rule line]
Reviews (1): Last reviewed commit: "Support PICT-compatible inline schema de..." | Re-trigger Greptile |
Summary
name: rulealongside the existing two-line schema formatWhy
Issue #163 requested compatibility with PICT-style enum definitions so schemas can be copied over without rewriting each field into the two-line format.
Validation
pnpm run verify:local