Forum Discussion

chubbydude's avatar
12 years ago

Generate request examples with xsd-restrictions

Hi,

I would like to know if it's possible to generate a request-example with values that follow a regex pattern from the XSD-file / element-type?`

After enabling Preferences->WSDL Settings->Sample Values I get latin words in all fields and I get restricted values in some fields, but not in types with pattern-restrictions on values (only works on base, as the generator sets the value as string in example 2).

Sample 1, WORKS
   <xs:complexType name="codeByValue">
<xs:attribute name="codeBase" fixed="1.2.3.4.5.6" use="required" />
</xs:complexType>


Generates codeBase="1.2.3.4.5.6"

Sample 2, NOT WORKING
    <!-- Telecom number format +321-101010101 -->
<xs:simpleType name="TelecomNumberType">
<xs:restriction base="xs:string">
<xs:pattern value="\+\d+-\d+"/>
</xs:restriction>
</xs:simpleType>


Generates <number>profundum quippe ferant</number>

I've noticed that I can validate my outgoing request if enabling Preferences->Editors Settings->Validate Request, where the value restriction in sample 2 cast an exception if the value doesn't follow the value-pattern, and that helps a lot... but it would be great if the values would be generated correctly according to the schema from the beginning. So, is this possible or do I need to change the values for each request manually?

Best regards,

Chubby
No RepliesBe the first to reply