Skip to content

Supported Input Formats

This code generator supports the following input formats:

Implemented data types and features

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

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
  • idn-email
  • path
  • uuid (uuid1/uuid2/uuid3/uuid4/uuid5)
  • ipv4
  • ipv6
  • hostname
  • decimal

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)