Skip to content

JSON Schema vs TypeScript Interface

Jan Rembold edited this page Jan 31, 2018 · 4 revisions

This article is work-in-progress and needs more discussion on priority of each point!

Why do we need a schema definition?

  • Describe the component templates' data structure for easy backend implementation or automated validation of APIs
  • Validate the demo/scaffolding data structures

Technical impacts

Development Runtime

  • Validate scaffolding data structures
  • Auto-Completion for scaffolding data structures

Challenges:

  • Load schema/interface together with hbs gulp task
  • Validate data in code editor while typing

Distribution Styleguide (Indexr)

  • Display the schema/interfaces pretty printed on each components overview

Challenges:

  • Convert schema/interface to prettified/highlighted markup
  • Output data in standardized format

Proof-of-concept

TypeScript Interface

JSON Schema