Sharing data types on a multi-language project

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • quicktype

    Generate types and converters from JSON, Schema, and GraphQL

  • This is a very intriguing problem!

    Not trying to steal thunder, but quicktype (https://github.com/quicktype/quicktype) does all of this–JSON schema or TypeScript definitions to de/serializers and types in nearly 30 languages at this point. Try it here: https://app.quicktype.io

  • raml-spec

    Discontinued RAML Specification

  • Taking this concept further one could model in RAML [0] to define both the types (flat or nested) and api definitions. It's based on YAML 1.2 with enough maturity to provide capabilities such as union types, extensions, includes, user-defined facets, etc.

    The AMF project [1] can be used to parse and transform to/from RAML, OpenAPI, GraphQL, and json schema. Code generation to languages of choice can be bolted on from there.

    I'm using this approach to define canonical data models. Subsequent code generation scaffolds internal application integration apis, master data management (MDM) entities, and SQL/OLAP artifacts for ETL / BI purposes.

    This approach keeps overall end-to-end data architecture consistent, in sync, and versioned under source control. Additionally, flat types as required by relational systems are re-used and composed into nested complex types more appropriate for apis. Metadata is layered on as needed to refine the models for system-specific needs, for example to add user-facing field groups, descriptions, and formats for BI datasets, sensitivity levels and other data security controls, business rule definitions for MDM, etc.

    [0] https://github.com/raml-org/raml-spec/blob/master/versions/r...

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts