Universal schema language that compiles to many type systems
Site Playground Docs
Today multi-service architectures requires developers to keep in sync a lot of different services built in different languages by different teams. Doing this manually requires a lot of work always changing the shared object types between different projects and a lot of integration tests to make sure that all the services can communicate. With skema you can have one single source of truth for your shared types and have static checkers warn you when some services use different shared types.
adding other languages support is pretty straightforward
Requires python 3.6+
pip install skema
# Generating types
cat ./schema.skema | skema to python > types.py
cat ./schema.skema | skema to typescript > types.ts
cat ./schema.skema | skema to jsonschema > types.json
# From jsonschema to graphql
cat ./schema.json | skema from jsonschema | skema to graphql > ./schema.graphql
# From graphql to python
cat ./schema.graphql | skema from graphql | skema to python > ./types.py
# Use your imagination
User:
id: Int
name: Str
address:
street: Str
number: Int
state: Str
credit: Float
email: Str
CronString: Str
Pet:
name: Str
friends: [Pet] # you can reference other types
Owner:
full_name: Str
hobbies: [
name: Str
when: CronString
]
Animal: Tiger | Bear | Panthera
ObjectId: Any
Panthera:
_id: ObjectId # a type alias
black_nuance: "super_dark" | "dark" | "light" # enumeration
Tiger:
_id: ObjectId
humans_killed: Int
Bear:
_id: ObjectId
likes_honey: Bool
Centaur: Horse & Human
Horse:
name: Str
eats: "carrots" | "weeds"
Human:
name: Str
surname: Str
eats: "meat" | "vegetables"
Str | Int
means one of string or intObject1 & Object2
means "all the properties of object 1 and 2"Object1 | Object2
means "properties of object 1 or 2"