Generator Config#

The configuration offers more advance options to further tail the output to your needs, like naming conventions and substitutions.

Warning

Since v21.12 the aliases were replaced by the substitutions config which is a more flexible search and replace process with support for regular expressions.

During initialization aliases will be migrated to substitutions and the config will be automatically updated, but you should also verify you still get the desired output.

Initializing configuration file .xsdata.xml
<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns="http://pypi.org/project/xsdata" version="23.8">
  <Output maxLineLength="79" subscriptableTypes="false" unionType="false">
    <Package>generated</Package>
    <Format repr="true" eq="true" order="false" unsafeHash="false" frozen="false" slots="false" kwOnly="false">dataclasses</Format>
    <Structure>filenames</Structure>
    <DocstringStyle>reStructuredText</DocstringStyle>
    <FilterStrategy>allGlobals</FilterStrategy>
    <RelativeImports>false</RelativeImports>
    <CompoundFields defaultName="choice" forceDefaultName="false">false</CompoundFields>
    <PostponedAnnotations>false</PostponedAnnotations>
    <UnnestClasses>false</UnnestClasses>
    <IgnorePatterns>false</IgnorePatterns>
    <IncludeHeader>false</IncludeHeader>
  </Output>
  <Conventions>
    <ClassName case="pascalCase" safePrefix="type"/>
    <FieldName case="snakeCase" safePrefix="value"/>
    <ConstantName case="screamingSnakeCase" safePrefix="value"/>
    <ModuleName case="snakeCase" safePrefix="mod"/>
    <PackageName case="snakeCase" safePrefix="pkg"/>
  </Conventions>
  <Substitutions>
    <Substitution type="package" search="http://www.w3.org/2001/XMLSchema" replace="xs"/>
    <Substitution type="package" search="http://www.w3.org/XML/1998/namespace" replace="xml"/>
    <Substitution type="package" search="http://www.w3.org/2001/XMLSchema-instance" replace="xsi"/>
    <Substitution type="package" search="http://www.w3.org/1998/Math/MathML" replace="mathml3"/>
    <Substitution type="package" search="http://www.w3.org/1999/xlink" replace="xlink"/>
    <Substitution type="package" search="http://www.w3.org/1999/xhtml" replace="xhtml"/>
    <Substitution type="package" search="http://schemas.xmlsoap.org/wsdl/soap/" replace="soap"/>
    <Substitution type="package" search="http://schemas.xmlsoap.org/wsdl/soap12/" replace="soap12"/>
    <Substitution type="package" search="http://schemas.xmlsoap.org/soap/envelope/" replace="soapenv"/>
    <Substitution type="class" search="(.*)Class$" replace="\1Type"/>
  </Substitutions>
  <Extensions/>
</Config>

GeneratorConfig

Generator configuration binding model.

GeneratorOutput

Main generator output options.

OutputFormat

Output format options.

GeneratorConventions

Generator global naming conventions.

GeneratorSubstitutions

Generator search and replace substitutions for classes, fields, packages and modules names.

GeneratorExtensions

Generator extensions for classes.

StructureStyle

Code writer output structure strategies.

DocstringStyle

Code writer docstring styles.

ClassFilterStrategy

Class filter strategy.

CompoundFields

Compound fields options.

ObjectType

Object type enumeration.

ExtensionType

Extension type enumeration.

GeneratorSubstitution

Search and replace substitution for a specific target type based on re.sub()

GeneratorExtension

Add decorators or base classes on the generated classes that match the class name pattern.

NameConvention

Name convention model.

NameCase

Code writer naming schemes.