-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conda-forge.yml
Pydantic Model: Single Values instead of Lists
#1869
Comments
conda-forge.yml
Pydantic Model: Single Values instead of conda-forge.yml
Pydantic Model: Single Values instead of Lists
What is in the model doesn't actually matter. You need to check the smithy source code to see if single values are allowed. If they are, then the model is wrong. The source code came first and is the source of truth on what is allowed for each field. |
conda-smithy supports single values for conda-smithy/conda_smithy/configure_feedstock.py Lines 2107 to 2109 in 44acb93
It's also valid for
So this is actually an error in the model, which can be fixed like I proposed above. |
Great and thanks for tracking that down! Let's fix the model! |
We can't use pydantic prevalidators because that's not used at runtime (we use jsonschema for the validation instead). What we can do is to turn the |
(Moved from #1865)
The conda-forge.yml schema contains fields like
nooarch_platforms
,remote_ci_setup
that expect a list but some feedstocks just supply a single value, which is not supported by the model currently. Even our own documentation currently specifies a value that is not supported by the model (see below -Optional[List]
does not support this).conda-smithy/conda_smithy/schema.py
Lines 710 to 719 in 85ddb5d
How to deal with this? One option would be to add a custom type that has a BeforeValidator converting single values to a list with only one item. I did a similar thing for the Pydantic models for cf-scripts:
https://github.com/ytausch/cf-scripts/blob/ea9cec3a988141e54d625169de60215bf3d8ff41/conda_forge_tick/models/common.py#L47-L58
The alternative would be to strictly support lists only and change the documentation and affected feedstocks.
@jaimergp
The text was updated successfully, but these errors were encountered: