Skip to content

📚 Supported Input Formats

This code generator supports the following input formats:

Use --input-file-type auto (the default) for common files, or set an explicit type when a file extension is ambiguous. For example, YAML can contain either an OpenAPI/JSON Schema document or raw sample data, so use jsonschema, openapi, or yaml depending on the intended input.

📘 OpenAPI 3 and JSON Schema

Below are the data types and features recognized by datamodel-code-generator for OpenAPI 3 and JSON Schema.

✅ Implemented data types and features

📊 Data Types

  • string (supported keywords: pattern/minLength/maxLength)
  • number (supported keywords: maximum/exclusiveMaximum/minimum/exclusiveMinimum/multipleOf)
  • integer (supported keywords: maximum/exclusiveMaximum/minimum/exclusiveMinimum/multipleOf)
  • boolean
  • array
  • object

📝 String Formats

  • date
  • datetime
  • time
  • password
  • email (requires email-validator)
  • idn-email (requires email-validator)
  • idn-hostname
  • path
  • uuid (uuid1/uuid2/uuid3/uuid4/uuid5)
  • ulid (requires python-ulid)
  • ipv4
  • ipv4-network
  • ipv6
  • ipv6-network
  • hostname
  • decimal
  • uri
  • uri-reference
  • uri-template
  • iri
  • iri-reference
  • json-pointer
  • relative-json-pointer
  • regex

🔗 Other schema

  • enum (as enum.Enum or typing.Literal)
  • allOf (as Multiple inheritance)
  • anyOf (as typing.Union)
  • oneOf (as typing.Union)
  • $ref (http extra is required when resolving $ref for remote files.)
  • $id (for JSONSchema)