Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of nillable = true & null primitive types #101

Open
jamienich opened this issue Oct 27, 2024 · 0 comments
Open

Handling of nillable = true & null primitive types #101

jamienich opened this issue Oct 27, 2024 · 0 comments

Comments

@jamienich
Copy link

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?

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

No branches or pull requests

1 participant