Skip to content

Clean up TSVB API interface, convert to typescript #57342

@flash1293

Description

@flash1293

The TSVB plugin is largely untyped. This is especially problematic because large config objects are sent from the client to the server without a defined shape. A preliminary Joi schema validating the config objects is currently in place in src/plugins/vis_type_timeseries/server/routes/post_vis_schema.ts, but might contain subtle mistakes, especially since saved objects can contain configurations created with old, potentially buggy versions of TSVB.

Additionally the TSVB server side code still assumes the shape of the legacy platform request object in some places - this abstraction is leaking out into the search strategy extension point used by rollup.

To clean this up and get to a well-defined API interface (both for the route and extension point), multiple clean up steps are required:

  • Turn Joi schema into @kbn/schema - this will provide a type we can use elsewhere
  • Type client code to make sure it conforms to the schema Convert vis_type_timeseries client side code to Typescript #63593
  • Get rid of request facade in server code to provide a nicer extension point for search strategies (this should to be done before typing the server because otherwise a lot of legacy code has to be typed before it gets removed) [TSVB] Remove request facade and type server code #92964
  • Type server code to make sure it conforms to the schema
  • Change client code to only create well-formed config objects (e.g. no empty strings also allowed for number fields)
  • Write saved object migration to clean up ugly parts of schema
  • Lock down schema to necessary shape
  • Convert vis_type_timeseries client side code to Typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:TSVBTSVB (Time Series Visual Builder)Team:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//impact:lowAddressing this issue will have a low level of impact on the quality/strength of our product.technical debtImprovement of the software architecture and operational architecture

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions