xsdata.models.config module

class xsdata.models.config.OutputFormat(value)[source]

Bases: enum.Enum

Available output formats: pydata (dataclasses), PlantUML class diagram.

DATACLASS = 'pydata'
PLANTUML = 'plantuml'
class xsdata.models.config.OutputStructure(value)[source]

Bases: enum.Enum

Available output structure strategies, based on filenames or the target namespaces.

FILENAMES = 'filenames'
NAMESPACES = 'namespaces'
class xsdata.models.config.NameCase(value)[source]

Bases: enum.Enum

Available naming schemes, pascal, snake, camel, mixed and mixed underscore.

PASCAL = 'pascalCase'
CAMEL = 'camelCase'
SNAKE = 'snakeCase'
MIXED = 'mixedCase'
MIXED_SNAKE = 'mixedSnakeCase'
property func

Return the actual callable of the scheme.

Return type

Callable

class xsdata.models.config.GeneratorOutput(wsdl=False, package='generated', format=<OutputFormat.DATACLASS: 'pydata'>, structure=<OutputStructure.FILENAMES: 'filenames'>, compound_fields=False)[source]

Bases: object

Main generator output options.

Parameters
  • wsdl (bool) – Enable wsdl mode

  • package (str) – Package name eg foo.bar.models

  • format (OutputFormat) – Select an output format

  • structure (OutputStructure) – Select an output structure

  • compound_fields (bool) – Use compound fields for repeating choices. Enable if elements ordering matters for your case.

wsdl: bool = False
package: str = 'generated'
format: xsdata.models.config.OutputFormat = 'pydata'
structure: xsdata.models.config.OutputStructure = 'filenames'
compound_fields: bool = False
class xsdata.models.config.NameConvention(case, safe_prefix)[source]

Bases: object

Name convention model.

Parameters
  • case (NameCase) – Naming scheme, eg camelCase, snakeCase

  • safe_prefix (str) – A prefix to be prepended into names that match reserved words.

case: xsdata.models.config.NameCase
safe_prefix: str
class xsdata.models.config.GeneratorConventions(class_name=<factory>, field_name=<factory>, module_name=<factory>, package_name=<factory>)[source]

Bases: object

Generator global naming conventions.

Parameters
class_name: xsdata.models.config.NameConvention
field_name: xsdata.models.config.NameConvention
module_name: xsdata.models.config.NameConvention
package_name: xsdata.models.config.NameConvention
class xsdata.models.config.GeneratorAlias(source=None, target=None)[source]

Bases: object

Alias definition model.

Parameters
  • source (Optional[str]) – The source name from schema definition

  • target (Optional[str]) – The target name of the object.

source: str = None
target: str = None
class xsdata.models.config.GeneratorAliases(class_name=<factory>, field_name=<factory>, package_name=<factory>, module_name=<factory>)[source]

Bases: object

Generator aliases for classes, fields, packages and modules that bypass the global naming conventions.

Parameters
class_name: List[xsdata.models.config.GeneratorAlias]
field_name: List[xsdata.models.config.GeneratorAlias]
package_name: List[xsdata.models.config.GeneratorAlias]
module_name: List[xsdata.models.config.GeneratorAlias]
class xsdata.models.config.GeneratorConfig(output=<factory>, conventions=<factory>, aliases=<factory>)[source]

Bases: object

Generator configuration binding model.

Parameters
class Meta[source]

Bases: object

name = 'Config'
namespace = 'http://pypi.org/project/xsdata'
version: str = '20.11.1'
output: xsdata.models.config.GeneratorOutput
conventions: xsdata.models.config.GeneratorConventions
aliases: xsdata.models.config.GeneratorAliases
classmethod create()[source]
Return type

GeneratorConfig

classmethod read(path)[source]
Parameters

path (Path) –

Return type

GeneratorConfig

classmethod write(output, obj)[source]
Parameters