xsdata.codegen.validator module

class xsdata.codegen.validator.ClassValidator(container)[source]

Bases: object

Run validations against the class container in order to remove or merge invalid or redefined types.

Parameters

container (ClassContainer) –

container: ClassContainer
classmethod process(container)[source]

Static entry point for container validation.

Parameters

container (ClassContainer) –

validate()[source]

Remove if possible classes with the same qualified name.

Steps:
  1. Remove classes with missing extension type.

  2. Handle duplicate types.

  3. Mark strict types.

remove_invalid_classes(classes)[source]

Remove from the given class list any class with missing extension type.

Parameters

classes (List[Class]) –

classmethod handle_duplicate_types(classes)[source]

Handle classes with same namespace, name that are derived from the same xs type.

Parameters

classes (List[Class]) –

classmethod merge_redefined_type(source, target)[source]

Copy any attributes and extensions to redefined types from the original definitions.

Redefined inheritance is optional search for self references in extensions and attribute groups.

Parameters
classmethod select_winner(candidates)[source]

Returns the index of the class that will survive the duplicate process.

Classes that were extracted from in xs:override/xs:redefined containers have priority, otherwise pick the last in the list.

Parameters

candidates (List[Class]) –

Return type

int

classmethod find_circular_extension(target)[source]

Search for any target class extensions that is a circular reference.

Parameters

target (Class) –

Return type

Optional[Extension]

classmethod find_circular_group(target)[source]

Search for any target class attributes that is a circular reference.

Parameters

target (Class) –

Return type

Optional[Attr]

classmethod mark_strict_types(classes)[source]

If there is a class derived from xs:element update all xs:complexTypes derived classes as strict types.

Parameters

classes (List[Class]) –