-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat(utils): Wsdl to TS typings #3886
Conversation
A potential (and correct) output for "WUQueryActivationMode" could be:
Note: WsDFU has a few more of these... |
Next you could generate the calling stub for each
You will need to use the associated
|
FYI - I tidied up the util folder a bit in this draft PR: jeclrsg#1 |
packages/comms/utils/index.ts
Outdated
const primitiveType = operation[prop].replace(/xsd:/gi, ""); | ||
if (prop.indexOf("[]") > 0) { | ||
typeDefn[prop.slice(0, -2)] = primitiveType + "[]"; | ||
} else if (operation[prop].match(/.*\|.*\|.*/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what this looks like, but does this catch enums with only 2 options (TRUE|FALSE)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment to this. Looking at it again, realized that regex wasn't matching value(s) of an enum, but the string that node soap generates to represent an enum, which is always EnumName|type|values
edc50fc
to
212a285
Compare
I noticed there was a small issue where the members of the generated TS interfaces were being delimited by commas instead of semi-colons. That seems to be technically valid, but I thought I would go ahead and have them be replaced with semi-colons for consistency (https://typescript-eslint.io/rules/member-delimiter-style). I also squashed & rebased to trunk, so hopefully I didn't miss anything when merging the conflicts in package.json. |
I think I covered the most recent requests for changes - the path where the .ts files are written is now of the format .../ServiceName/v#/ServiceName.ts, and the body of each operation is calling the connection wrapper around the service call. I changed the usage comments slightly as well, noting that you can alternatively pass a local path to a WSDL file as well as a URL. Rodrigo was nice enough to provide me with a copy of the ws_logaccess WSDL yesterday afternoon. |
The request interface need to optional either by:
or
I suspect the later is needed for nested structures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment re optional fields in the reqeusts
Signed-off-by: Jeremy Clements <[email protected]>
Checklist:
Testing: