feat(validators): add study validator library and studyu_validator CLI#866
Draft
ibrahimozkn wants to merge 28 commits into
Draft
feat(validators): add study validator library and studyu_validator CLI#866ibrahimozkn wants to merge 28 commits into
ibrahimozkn wants to merge 28 commits into
Conversation
|
Visit the preview URL for this PR (updated for commit 0894fe0):
(expires Fri, 10 Jul 2026 18:20:42 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2149dad49ed83535217e50d5c18c0c8c90da629b |
0822e48 to
22b4ef7
Compare
- field table: show `field (json_key)` when names differ; add Default column populated from field initializers and @jsonkey(defaultValue:) - remove `<!-- Human prose goes here. -->` placeholder from skeleton and strip it from previously generated pages on next --write run - dispatcher pages (Question, Expression): collect concrete subtype wire values scoped to the same directory, not all classes globally - filter keyType constants so they are not misread as wire values - drift check: fail when metadata describes a field absent from source (unless virtual: true) and when metadata is missing a title - mark SliderQuestion.initial as virtual in _metadata.yaml (getter only) - add doc_metadata_test.dart (7 tests) and expand generated_block_test and page_scope_test with discriminator and fieldLabel coverage - 41 unit tests passing, 0 analyzer warnings
Replace blank default cells with - in generated field tables. Add model_scanner_test.dart covering buildDispatcherDiscriminators and ScannedField/ScannedClass data classes. Regenerate all doc pages to reflect the new placeholder.
…rvention count check
Empty consent at publish level must be an error, not a warning — the CLI section flag test specifies this contract.
768a5bf to
b19d765
Compare
…etailed descriptions
…lds and enhance link validation
…atting and descriptions
feat(core): add study_data_docs generator and generated docs tree
Add a two-stage study-data validation pipeline: a fast JSON Schema gate over raw decoded JSON, followed by the existing Study.fromJson plus cross-entity Dart validators only when schema validation succeeds. - core/tool/emit_schema.dart: standalone emitter generating core/lib/src/validators/schema/study.schema.json from the committed model serializers (Draft 7, additionalProperties: false, oneOf discriminators with const, nullable via type arrays/anyOf) - studyu_validator: insert schema pass into validateJson and validateSection, add --schema-only flag and replace schema stub with schema subcommand printing the checked-in schema - .github/workflows/schema-validate.yml: node-only CI validating the portable fixture against the schema with ajv-cli - pubspec.yaml: add docs:study-data:schema melos script - tests: 20 cases proving stage separation, schema-only mode, schema command, and conflicting flag rejection
ajv-cli does not include format validators, causing date-time format in the schema to be rejected. Use ajv + ajv-formats directly instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a composable study validator to
core, a standalonestudyu_validatorCLI package, and a deterministic docs generator forstudyu_coremodels.core — validator library:
ValidationLevel(draft / publish) andValidationResulttypesvalidateStudy()composes all validators; individual validators exported fromcore.dartStudyFixtureswithfullValid()and targeted invalid variants for each error codeconsent.no_itemsandinterventions.no_tasksare warnings, not errorsstudyu_validator CLI:
validate <file>— parse JSON and runvalidateStudy, exit 0/1validate --level publish— switch validation levelvalidate --section <name>— run a single entity validatornormalize <file>— round-trip throughStudy.fromJson/toJsontools/study_data_docs — docs generator (PR 3b):
tools/study_data_docsworkspace package (pure Dart,package:analyzer12.x)--writegeneratescore/docs/study-data/from Dart source +.g.dartfiles--checkexits non-zero when docs drift from source; wired intoqualitycheck<!-- GENERATED:FIELDS START/END -->,<!-- GENERATED:DISCRIMINATORS START/END -->,<!-- GENERATED:LINKS START/END -->studyu_coremodelsdocs:study-data:write,docs:study-data:checkVisuals
N/A — CLI and library only, no UI changes.
Testing Steps
PR Checklist
fvm exec melos run qualitycheckpasses