Skip to content

TypeSchema is a JSON format to describe data models in a language neutral format

License

Notifications You must be signed in to change notification settings

apioo/typeschema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

167952d · Feb 22, 2025
Feb 22, 2025
Nov 22, 2024
Nov 30, 2024
Feb 22, 2025
Feb 22, 2025
Jan 29, 2022
Nov 30, 2024
Apr 16, 2023

Repository files navigation

TypeSchema

About

TypeSchema is a JSON specification to describe data models.

A TypeSchema specification can be easily transformed into code for almost any programming language. This helps to reuse core data models in different environments. More information at: https://typeschema.org

The TypeSchema meta specification which describes the specification itself is located at specification/typeschema.json. We automatically push the specification to the TypeHub platform where you can see also a rendered version of the specification and download the auto generated models.

Features

  • An elegant specification optimized for code-generation
  • A portable format to share data models across different programming languages
  • Generate clean and simple to use DTOs
  • Handle advanced concepts like inheritance, polymorphism and generics
  • Use reflection to easily turn any class into a TypeSchema specification
  • Easily implement your own code generator

Generator

We provide a hosted version of the code generator at our website. To transform a TypeSchema specification into code you can use our generator docker image. Simply run docker-compose up which reads the typeschema.json specification from the output/ folder and writes the generated code back into this folder.

services:
  generator:
    image: apiootech/typeschema-generator:0.6
    environment:
      # possible formats: csharp, go, java, php, python, rust, typescript
      FORMAT: "java"
      NAMESPACE: "org.acme"
      SOURCE: "typeschema.json"
    volumes:
      - ./output:/usr/src/typeschema/output

For more advanced integration options please take a look at the SDKgen project which offers various integration options like a CLI, GitHub action or REST API.

Models

TypeSchema provides auto-generated models which describe the specification itself. These models can be used if you want to work with a TypeSchema specification.

Language GitHub Package
C# GitHub Nuget
Go GitHub
Java GitHub Maven
JavaScript GitHub NPM
PHP GitHub Packagist
Python GitHub PyPI