DevToolsHub Free · Fast · 100% in your browser

OpenAPI to C#

Generate C# classes, records and enums from OpenAPI 3.x or Swagger 2.0 schemas (JSON or YAML).

About this OpenAPI to C# model generator

Generate C# DTO classes or records and enums from an OpenAPI 3.x or Swagger 2.0 specification in JSON or YAML. Types, formats, nullability, required properties, arrays, dictionaries, allOf inheritance and inline objects are mapped to idiomatic C# with optional System.Text.Json attributes.

How to use the OpenAPI to C#

  1. Paste the OpenAPI or Swagger document.
  2. Choose classes or records and attributes.
  3. Generate and copy the code.

Example

{ type: string, format: date-time }  →  DateTimeOffset

Frequently asked questions

Does it generate API clients?

No, only the model types from the schemas section. Use them with HttpClient and System.Text.Json or a client generator.

Is my data safe?

Yes. The tool runs entirely in your browser using WebAssembly. Nothing you type or upload is sent to a server, logged or stored.

Is it free?

Yes, completely free with no sign-up, no limits and no watermarks. It also works offline once the page has loaded.

An unhandled error has occurred. Reload ✕