How to export JSON Schemas
The schemas/ directory holds JSON Schema files generated from the package’s
Pydantic models. This guide shows how to regenerate them after the models change,
and how consumers use them.
Export from the CLI
Section titled “Export from the CLI”Write one <model>.schema.json file per model into a directory:
researcher-profiles schema export schemas/Expected output:
wrote schemas/profile_metadata.schema.jsonwrote schemas/profile_config.schema.jsonwrote schemas/papers_file.schema.jsonwrote schemas/summary_file.schema.jsonwrote schemas/question.schema.jsonThe command creates the output directory if it does not exist and overwrites any
existing schema files. Run it whenever you change a model in
researcher_profiles.schema so the checked-in files stay in sync.
Export programmatically
Section titled “Export programmatically”Use export_schemas to write the files, or build_schemas to get the schema
dicts in memory:
from researcher_profiles.schema_export import export_schemas, build_schemas
written = export_schemas("schemas") # returns list[Path]print([p.name for p in written])
schemas = build_schemas() # returns {name: json_schema_dict}print(sorted(schemas))What each file validates
Section titled “What each file validates”| File | Validates | Source model |
|---|---|---|
profile_metadata.schema.json | profile.yaml | ProfileMetadata |
profile_config.schema.json | config.json | ProfileConfig |
papers_file.schema.json | sources/papers.yaml | PapersFile |
summary_file.schema.json | sources/summaries/*.summary.md frontmatter | SummaryFile |
question.schema.json | meta/questions.yaml entries | Question |
See the schema reference for the fields in each model.
Using the schemas without the package
Section titled “Using the schemas without the package”The point of the checked-in files is that a consumer can validate a profile
without installing this package, using any JSON Schema validator in any language.
Load the schema file and the target artifact (parsing YAML to JSON-compatible
data first) and validate. See
Validate a profile
for a Python example with the jsonschema package.