Skip to content

Conversation

@swozny13
Copy link

When a complexType with only attributes was extended by another complexType, the attributes were being rendered as "NotSet" instead of their actual values. This occurred because a placeholder element was unnecessarily created during type extension, causing the base type to be rendered twice - once with correct values and once with empty values that overwrote the correct ones.

Fixes #991

When a complexType with only attributes was extended by another
complexType, the attributes were being rendered as "NotSet" instead
of their actual values. This occurred because a placeholder element
was unnecessarily created during type extension, causing the base type
to be rendered twice - once with correct values and once with empty
values that overwrote the correct ones.

Fixes mvantellingen#991
@swozny13
Copy link
Author

swozny13 commented Nov 26, 2025

Zeep version: 4.3.1

Example schema

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.com/test"
        xmlns:tns="http://example.com/test"
        elementFormDefault="unqualified"
        attributeFormDefault="unqualified">

  <complexType name="BaseType">
    <attribute name="attr1" type="integer" use="required"/>
    <attribute name="attr2" type="string" use="required"/>
  </complexType>

  <complexType name="ExtendedType">
    <complexContent>
      <extension base="tns:BaseType"/>
    </complexContent>
  </complexType>

  <element name="item" type="tns:ExtendedType"/>
</schema>

Reproduction

item = client.get_type('tns:ExtendedType')
obj = item(attr1=10, attr2="test")
print(etree.tostring(render(obj)))

Before fix

<item attr1="NotSet" attr2="NotSet"/>

After fix

<item attr1="10" attr2="test"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zeep setting defined valuesas 'NotSet'

1 participant