Closed ytausch closed 5 months ago
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 noarch_platforms
. See the following snippet:
It's also valid for remote_ci_setup
: https://github.com/conda-forge/conda-smithy/blob/44acb937c50ce98adf1b50b01a6ab7bc577d2fb2/conda_smithy/configure_feedstock.py#L586
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 list[something]
types into union[something, list[something]]
.
(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).https://github.com/conda-forge/conda-smithy/blob/85ddb5deabda9ab58ae6ec898e2a1e33393117b7/conda_smithy/schema.py#L710-L719
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