Currently we treat the component_type field in component config as a nice to have/optional.
We instead look at the run fields as defined in the config and choose the component model that best suits that.
The reason this has worked in the past was because it's structurally impossible for the two components types we support (continuous and scheduled)
to be a subset of each other.
scheduled has a schedule field that continuous will never have, so it's immediately obvious to pydantic which is which.
This is a problem now as we move forward to support webservice component type, because, the only thing that can reliably tell a webservice from a continuous component is the component_type field.
(their fields overlap, and as a result there are some combination of fields that can be mistaken for either webservice or continuous if the component_type field is not provided)
Things to keep in mind
We'll need to figure out migration.
We can do this for sure by bumping config version, and leave behind support code to help parse old config version to the newer version. This might include some prometheus things to detect anyone still using the old config version.
something that helps here is that we can be sure that webservice component_type has never been supported for the old config version, so we can assume that any continuous shaped run belongs to the continuous component_type.
for configs in our storage, we can run a migration script that'd add component_type field to them all.
Update:
We went with @dcaro's suggestion instead of renaming the command field: component_type is required for webservice components only. Continuous and scheduled components without component_type are still picked by their run fields, so no migration is needed, and existing configs keep working.
The trade-off is that component_type is required for one type but optional for the other two. We accepted that to avoid a breaking change for existing configs.