lumen
lumen copied to clipboard
`state.to_spec` should validate if type is correct
Right now, state.to_spec
will run the respective class to_spec
method. There should be a type check to validate that the type is correct, e.g., layouts
should have the type of Layouts:
import lumen
import panel as pn
import yaml
from lumen.layout import Layout
from lumen.pipeline import Pipeline
from lumen.sources import FileSource
from lumen.views import Table
pn.extension("tabulator")
data_url = "https://datasets.holoviz.org/penguins/v1/penguins.csv"
pipeline = Pipeline(source=FileSource(tables={"penguins": data_url}), table="penguins")
pipeline.add_filter("widget", field="species")
pipeline.add_filter("widget", field="island")
pipeline.add_filter("widget", field="sex")
pipeline.add_filter("widget", field="year")
view = Table(pipeline=pipeline)
This should raise an error
specification = lumen.state.to_spec(
config={"title": "test"},
layouts=[view],
)
I can submit a PR, but I want to be sure I have not overlooked anything.