Skip to content

All properties in the generated interfaces are set to optional even if they are required #98

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

Open
dikue opened this issue Sep 23, 2024 · 2 comments

Comments

@dikue
Copy link

dikue commented Sep 23, 2024

As the titel says, all properties are optional. It seems like the code is missing a check for the xml property minOccurs.

@stuikomma
Copy link

I have added this feature in my fork here https://github.com/stuikomma/wsdl-tsclient. It is quite a hacky implementation, but it works on our WSDL and on e.g. the marketo.wsdl example in this repo.

Note that this only handles whether a property is marked optional. Checking whether something should be nullable could be implemented similarly, but I didn't do it, because we don't need it for our use case.

@dderevjanik If you are interested in this functionality, I'd be willing to open a PR and clean up the implementation.

@danielb7390
Copy link

Hi,
I will leave this here in case it helps someone else.

In your fork you have this line

const originalSchema = wsdl.definitions.schemas[inputMessage.element.targetNamespace].complexTypes[typeNameWithoutNamespace];

With the wsdl im using, originalSchema would always be undefined, because typeNameWithoutNamespace wouldn't match the case of the keys inside complexTypes.
I ended up doing this, it seems to work for my case, not sure if it's correct or not!

  const originalSchema =
                                        (wsdl.definitions.schemas[inputMessage.element.targetNamespace].complexTypes[
                                            typeNameWithoutNamespace
                                        ]) || (wsdl.definitions.schemas[inputMessage.element.targetNamespace].complexTypes[
                                            inputMessage.element.$name
                                        ]);

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

3 participants