Code Generator¶
CLI Entry Point¶
$ xsdata --help
Usage: xsdata [OPTIONS] XSD_PATH
Options:
--package TEXT Target Package [required]
--renderer [pydata|plantuml] Output renderer
--print Preview the resulting classes.
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG
--help Show this message and exit.
XSD Path¶
The generator doesn’t work with urls only with local files, if the given schema includes other schemas with urls the generator will fail. Every schema is evaluated once and in the order they are defined.
Circular dependencies will probably work just fine :)
Package¶
The package option defines where the target module(s) will be created inside the current working directory.
If the main xsd has any parent include or import you should adjust the target package.
Example
Output directory
./api/modelsMain xsd
./api/air/AirReqRsp.xsdthat includes../common/CommonReqRsp.xsdAdjust the package from
api.modelstoapi.models.airbecause the generator has to also create thecommon.common_req_rspmodule.
Renderer¶
The renderer option changes the output format.
pydata: Python lib dataclassesplantuml: PlantUML class diagram
Verbosity¶
The verbosity option changes what messages will be printed.
Available options: CRITICAL, ERROR, WARNING, INFO or DEBUG
Print¶
The print flag overwrites the verbosity level to Error and print to stdOut the output result without writing to the target file.
Examples
Check the Tests and the samples repo for more ✨✨✨