DIRACGrid / DIRACGrid/dirac-cwl
Why are we storing the models as dicts in `collect_pydantic_models()`?
- Dominant language
- Python
- Stars
- 3
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Why are we storing the models as dicts in `collect_pydantic_models()`?:
``` python
models.update(
{
"ExecutionHooksBasePlugin": ExecutionHooksBasePlugin,
"ExecutionHooks": ExecutionHooksHint,
"Scheduling": SchedulingHint,
"TransformationExecutionHooksHint": TransformationExecutionHooksHint,
}
)
```
Wouldn't it be better to collect them as a list of `Models` instead? There's a method in Pydantic that takes multiple models and create a schema based on that: https://docs.pydantic.dev/latest/api/json_schema/#pydantic.json_schema.models_json_schema (instead of calling `model_json_schema` for each model)
That way, we could potentially extract the model name directly from the `ConfigDict` title, instead of taking it from the script's dict. Pydantic should do most of the job I think?
I'm not sure if I'm explaining this clearly, but maybe it would be worth opening an issue to revisit the schema generation scripts. What do you think? @aldbr
_Originally posted by @Stellatsuu in https://github.com/aldbr/dirac-cwl-proto/pull/42#discussion_r2549596982_
This could be investigated before being integrated to DiracX, but this is very low priority.
Contributor guide
Assessment
This issue has not been assessed yet.