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

Support minOccurs=0 #8

Open
pauldraper opened this issue Nov 10, 2018 · 4 comments
Open

Support minOccurs=0 #8

pauldraper opened this issue Nov 10, 2018 · 4 comments
Projects
Milestone

Comments

@pauldraper
Copy link

Should be optional or undefined if minOccurs=0

@TimLuq
Copy link
Owner

TimLuq commented Nov 10, 2018

Unfortunately I don't believe this is something exposed by the soap library. If it were it could be added, otherwise this lib would need a complete rewrite with a custom XSD parser.

@TimLuq TimLuq added this to the v1.0 milestone Nov 10, 2018
@TimLuq TimLuq added this to Issues in v1.0 Nov 10, 2018
@pauldraper
Copy link
Author

I see that now :(

As is, the wsdl-to-ts cannot really be used with TS's strict nullable setting, as all elements become required.

@pauldraper
Copy link
Author

pauldraper commented Nov 10, 2018

(Thanks for the quick response, BTW! Great project.)

@TimLuq
Copy link
Owner

TimLuq commented Nov 11, 2018

Yes, the way to handle the situation currently is to either generate the types once and then do manual corrections or, it pains me to say, have objects containing properties whose undefined or null values has been cast to any.

interface ISomeInterface {
  description: string; // : string | null - in reality supports xsi:nil="true"
  name: string;
  restricted: boolean; // ?: boolean - in reality minOccurs="0"
}
const o: ISomeInterface = {
  description: null as any,
  name: "example",
  restricted: undefined as any,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.0
Issues
Development

No branches or pull requests

2 participants