-
Notifications
You must be signed in to change notification settings - Fork 246
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(jsii): check that referenced @param's exist #431
Conversation
@@ -645,18 +645,10 @@ export class Assembler implements Emitter { | |||
} | |||
|
|||
/** | |||
* Register documentations on a ``spec.Documentable`` entry. | |||
* | |||
* @param sym the symbol holding the JSDoc information |
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 is sad that you're dropping rich documentation and making it less nice, while you're fixing the problems with it...
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.
Didn't feel like it was adding a lot of value. If the parameter is declared as sym: Symbol
and the documentation basically says "this is the symbol", then I don't feel like the documentation is adding a lot of information.
Similarly for the return value. Declaration says: function(...): Docs
, I don't feel the need to add @returns the docs
.
packages/jsii/lib/assembler.ts
Outdated
const actualNames = new Set((method.parameters || []).map(p => p.name)); | ||
for (const param of params) { | ||
if (!actualNames.has(param)) { | ||
this._diagnostic(methodSym.valueDeclaration, ts.DiagnosticCategory.Error, |
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.
Could this be a warning instead? I mean - is there any reason to actually fail on this?
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 could, but I'm wary. In my experience, warnings don't get fixed. But sure, I'll throw in a warning.
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.
We can turn this into an error in a later version if you like (using. warning first gives some notice period, which is great for CDK releases :D)
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.
And - feel free to record this in an issue so we don't forget!
Verify integrity of the documentation by forcing the parameter names
referred to in @param declarations to actually exist.
Fixes #422.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.