@classmethod
def from_schema(cls, schema, schema_registry=None):
    """Construct a ComponentSchema from a schema.

        Args:
            schema (dict): Schema.

        Returns:
            ComponentSchema: Schema with information from schema.

        """
    schema_type = schema['title']
    out = cls(schema_type, schema_registry=schema_registry)
    out._base_schema = schema['allOf'][0]
    subt_schema = schema['allOf'][1]['anyOf']
    for v in subt_schema:
        out._storage[v['title']] = v
        subtypes = v['properties'][out.subtype_keys[0]]['enum']
        out.schema_subtypes[v['title']] = subtypes
    return out
