Skip to content

Handling of nillable = true & null primitive types #101

Description

@jamienich

The generated types don't include null when the wsdl element attribute nillable=true is set.
i.e.
my_generated_field string|null,

When the wsdl is parsed, nillable field settings can likely be inspected, to set null primitive types.
I may try and change the library to allow for literals which include the type and null (i.e. string|null) in the below code somewhere

function parseWsdl....
                                if (outputMessage.element) {
                                    const typeName = outputMessage.element.$type ?? outputMessage.element.$name;
                                    const type = parsedWsdl.findDefinition(typeName);
                                    outputDefinition = type ?? parseDefinition(
                                        parsedWsdl,
                                        mergedOptions,
                                        typeName,
                                        outputMessage.parts,
                                        [typeName],
                                        visitedDefinitions
                                    );
                                    // Check for nillable attribute
                                    **if (outputMessage.element.$nillable === "true") {
                                        //change the type definition from string to string|null**

Does this sound reasonable?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions