Allow custom_serializer to recognize cv.string and cv.boolean to make config schema more reusable (#41532)

This commit is contained in:
Raman Gupta 2020-10-09 03:36:54 -04:00 committed by GitHub
parent 852d1b2e67
commit d3734aae9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View file

@ -828,6 +828,12 @@ def custom_serializer(schema: Any) -> Any:
if schema is positive_time_period_dict:
return {"type": "positive_time_period_dict"}
if schema is string:
return {"type": "string"}
if schema is boolean:
return {"type": "boolean"}
if isinstance(schema, multi_select):
return {"type": "multi_select", "options": schema.options}