-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
[soap] Update SOAP definitions #18511
Conversation
- `Server` and `Client` are now exported as classes instead of interfaces. This allows extending these classes. - Added missing soap module exports: `WSDL`, `WSSecurityCert`, `ClientSSLSecurityPFX`, `passwordDigest` - Updated existing signatures for missing arguments or members. - Added interfaces: `IWSDLBaseOptions`, `IServerOptions`, `IXMLAttribute`, `IServicePort`, `IService`, `IServices`. - Semantics: - Refactored `Security` to `ISecurity` (`Security` is still declared for compatibility reasons) - Refactored `Option` to `IOptions` (`Option` is still declared for compatibility reasons) - Refactored `SoapMethod` to `ISOAPMethod` (`SoapMethod` is still declared for compatibility reasons)
the new `defaults` parameter is optional.
Seems good and useful |
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'm still reviewing. Submit the comment about naming convention first.
types/soap/soap-tests.ts
Outdated
@@ -1,18 +1,18 @@ | |||
import * as soap from 'soap'; | |||
import * as SOAP from 'soap'; |
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.
SOAP
doesn't align with naming conventions.
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.
This is ok.
types/soap/index.d.ts
Outdated
|
||
interface Security { | ||
export interface ISOAPMethod { |
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 prefer to treat abbreviations as if they were lower case words. See this highest vote answer in SO.
ISoapMethod
is more readable than ISOAPMethod
.
This comment also apply to WSDL
, e.g. IWSDLBaseOptions
.
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.
The soap
module itself has the followings:
WSSecurity
- notWsSecurity
ClientSSLSecurity
- notClientSslSecurity
ClientSSLSecurityPFX
- notClientSslSecurityPfx
Also, the original module exports WSDL
not Wsdl
I'm not only following my preferences, this is the original module's style/convention.
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 don't think there is a consistent style in node-soap project.
You can also find these:
wsdl_headers
wsdl_options
wsdlOptions
addSoapHeader
changeSoapHeader
soapError
Treating abbreviations as normal words increases readability. For example, a glance at ISOAPMethod
might become ISO-AP-Method
or IS-OAP-Method
.
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.
ok. see final changes. I'll keep WSDL
as is, since it's exported all in uppercase in node-soap.
@onury Please address comments from the code reviewers. |
types/soap/index.d.ts
Outdated
setSecurity(s: Security): void; | ||
[method: string]: SoapMethod | Function; | ||
setSecurity(security: ISecurity): void; | ||
[key: string]: any; // [method: string]: ISOAPMethod | Function; |
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.
it should be [key: string]: any; otherwise TS will complain on any member you add to the extended class if it doesn't have a type of SoapMethod | Function.
Can you give example code of extended class? I tried to write a sub class without changing it to any
and there was no error reported by TSC.
minor revisions. changed back to `[method: string]: ISOAPMethod | Function;`
@aleung - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
@onury Thanks for your update. Another thing I didn't point out yesterday. But after revisiting the code and doing some reading online, I think this definition should follow TypeScript coding guidelines interface naming rule:
There was a lot of discussion on it, e.g. microsoft/TypeScript-Handbook#121, inversify/InversifyJS#242. I‘m disposed to agree the argument in https://softwareengineering.stackexchange.com/a/117393/42485. I know style choice is somewhat personal favor. But since TypeScript team chooses this one and most of the files in https://github.com/DefinitelyTyped/DefinitelyTyped follow it, why us not? |
@aleung this is my preference. I'm proposing this PR as is. Let me know if I should close this. Thanks. |
@onury Thank you very much for your great work. Your PR fills up the missing APIs and makes it complete. I really don't want to see that the effort you pay is wasted. Keeping unified code style is one of the job that maintainer needs to do. |
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.
Do not use "I" as a prefix for interface names.
Use "I" prefix in interfaces or don't use is personal or team choice. As you @aleung mentioned above there is a lot of discussion about it and there is no single "right" point about it. Personally I and my team use "I" prefix for many practical reasons. So, you trying to force your personal preference upon independent author. For my point of view it looks bad. @onury types is much better then it is now and you rejecting his PR just because, let's talk it so: you didn't like his naming style |
While existing code were using one style ( Personally I don't feel using "I" prefix in interfaces is a good idea in TypeScript. As it was said in TypeScript Handbook:
can be rewritten to:
Are you saying that it's still an interface? |
Existing soap javascript code have no interfaces by obvious reasons, this is new entities in soap types. Those new entities may be styled as "without "I" prefix" and "with "I" prefix" and it's personal choice of author There is no "right" choice wich accepted by all or almost all community, and I think it's wrong to force one style And yes, interfaces can be rewritten as abstract classes or even types, but this changes nothing: existing soap code not exporting abstract classes nor types, so how to make this new entities is author choice And one more thing: if there was crowd of authors in entrance with different styled typings we would be able to choose "right" and "good" style. But there is only one PR and it's good PR - except you didn't like it's styling very much |
@aleung Yes, you can write it as an Well, is it really a type?.. It still enforces certain properties on an object/class which is what interfaces are for. Can you do The coding guide-lines for TypeScript you've mentioned is meant to be for contributors of the TypeScript project on GitHub. See the huge note here? That's not how TS developers should mandatorily write code. I personally adapt most of the suggestions there but not all. But that's not the point... I've previously made many changes you've asked, including naming style bec. I've agreed with you on for example, abbreviations to be treated as words for better readability. On interface names, I simply do not agree. But you won't come half-way, will you? I've given time and effort to complete the typings bec. you said "I had only add definitions for my need". Well, I've added the complete definitions (even the ones I don't use), even fixed bugs, out-dated signatures — for community needs. But It all got stuck with your style authoritarianism. So, will not wait anymore for your approval. here you go.. |
Please fill in this template.
npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
.Changes
Server
andClient
are now exported as classes instead of interfaces. This allows proper inheritance.WSDL
,WSSecurityCert
,ClientSSLSecurityPFX
,passwordDigest
IWSDLBaseOptions
,IServerOptions
,IXMLAttribute
,IServicePort
,IService
,IServices
.Security
toISecurity
(Security
is still declared for compatibility reasons) - RefactoredOption
toIOptions
(Option
is still declared for compatibility reasons)SoapMethod
toISOAPMethod
(SoapMethod
is still declared for compatibility reasons)