A worked example, rendered from real sample data. Sign in to run the tool on your own input.
{"openapi":"3.0.0","info":{"title":"API","version":"1.0"},"components":{"schemas":{"User":{"type":"object","required":["id","email"],"properties":{"id":{"type":"integer"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["admin","user"]},"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}},"Post":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"published":{"type":"boolean"}}}}}}export interface User {
id: number;
email: string;
name?: string;
role?: "admin" | "user";
posts?: Post[];
}
export interface Post {
id?: number;
title?: string;
published?: boolean;
}

Generate TypeScript interfaces from an OpenAPI schema. Part of the DevTools Surf developer suite. Browse more tools in the Developer Utilities collection.