Schemas and generated output

One .syln schema, type-safe code in every target

Each example shows the .syln source and the code SyncLangs generates from it. Start with a flat User type, then nest custom types and maps. The schema is the source of truth, so the TypeScript and Python stay in sync as it changes.

Share one User type across services

Define User once in .syln with an optional name and a list of roles. Generate the TypeScript interface and Python dataclass so your API and workers agree on the shape.

View the schema
schema.syln
type User {  id: string  email: string  name: string?  roles: list<string>  isActive: bool}
TypeScript output
export interface User {  id: string;  email: string;  name?: string;  roles: string[];  isActive: boolean;}
Python output
@dataclassclass User:    id: str    email: str    name: Optional[str]    roles: list[str]    is_active: bool

Nest custom types and keep them in sync

Reference a Point type inside Shape, hold a list of vertices, and carry arbitrary metadata in a map. Change Point once and every Shape in every target language updates on the next gen.

View the schema
schema.syln
type Point {  x: float  y: float} type Shape {  id: string  center: Point  vertices: list<Point>  metadata: map<string, any>}
TypeScript output
export interface Shape {  id: string;  center: Point;  vertices: Point[];  metadata: Record<string, any>;}
Python output
@dataclassclass Shape:    id: str    center: Point    vertices: list[Point]    metadata: dict[str, Any]