Skip to content

Schema generators#9

Open
RoboDoig wants to merge 6 commits into
mainfrom
schema-generators
Open

Schema generators#9
RoboDoig wants to merge 6 commits into
mainfrom
schema-generators

Conversation

@RoboDoig
Copy link
Copy Markdown
Contributor

@RoboDoig RoboDoig commented Mar 4, 2026

In this PR I add an example generator script for compiling pydantic schemas to json, json_schema.py allows for pooling relevant pydantic schemas and dumping to a combined json file.

It's useful to have a single point of entry for dumping json, but I also realised while working on the acqusition package that we often want to reference data types outside of data_types.json, e.g. when making operators for visual display it's useful to be able to reference e.g. DisplayCalibration. Initially I dumped each pydantic file into a separate json so that the acqusition package modules can pick and choose which data types they generate, but this results in overlap between partial classes, e.g. if you sgen both data_types and displays you'll get overlap with Vector3 as they both reference them. My solution here is just to dump all relevant schemas into a single, master json file.

@RoboDoig RoboDoig requested a review from NeuroThom March 4, 2026 18:00
@RoboDoig
Copy link
Copy Markdown
Contributor Author

RoboDoig commented Mar 5, 2026

After talking with @NeuroThom about this, I don't think this approach really works. In the end the issue is that you run sgen on the acqusition package one end, and then on your experiment project on the other. So you have two different generated classes with the same data types but without coersion between the types.

@RoboDoig
Copy link
Copy Markdown
Contributor Author

Potential solution here bonsai-rx/sgen#108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant