Code Generator

CLI Entry Point

$ xsdata --help
Usage: xsdata [OPTIONS] SOURCE

  Convert schema definitions to code.

  SOURCE can be either a filepath, directory or url

Options:
  --package TEXT              Target Package  [required]
  --output [pydata|plantuml]  Output Format
  --wsdl                      WSDL Mode (experimental)
  --print                     Print output
  --ns-struct                 Use namespaces to group classes in the same
                              module. Useful against circular import errors.

  --version                   Show the version and exit.
  -v, --verbosity LVL         Either CRITICAL, ERROR, WARNING, INFO or DEBUG
  --help                      Show this message and exit.

SOURCE

You can pass the file path or uri to a schema or a whole directory with multiple definitions.

$ xsdata amadeus/schemas --package amadeus.models

$ xsdata air_v48_0/AirReqRsp.xsd rail_v48_0/RailReqRsp.xsd --package travelport.models

$ xsdata http://www.gstatic.com/localfeed/local_feed.xsd --package feeds --print

package

Specify where the target module(s) will be created inside the current working directory. eg –package api.models

Note

The cli is relying on the os.path.commonpath of the schemas locations to create the final package structure. If you prefer a more flat structure or you have circular import errors check the option ns-struct.

output

Specify the output format

verbosity

Specify the log level, default is INFO

Available options: CRITICAL, ERROR, WARNING, INFO or DEBUG

wsdl

Generate models and services from a wsdl source.

Experimental

This feature is experimental and only a small subset of features have been implemented, WSDL 1.1 & SOAP 1.1 bindings.

print

Redirect generated code to stdOut instead of writing the output to the target files.

ns-struct

Group classes by the target namespace they were defined. This option creates a more flat package structure and solves many circular import errors.

Examples

Check the Demos and the samples repo for more ✨✨✨