-
Notifications
You must be signed in to change notification settings - Fork 645
OCPBUGS-56248: Improve Console plugin API doc gen script #15167
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
base: main
Are you sure you want to change the base?
Conversation
@vojtechszocs: This pull request references Jira Issue OCPBUGS-56248, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
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.
Thanks @vojtechszocs 👍
|
||
### Summary | ||
|
||
Hook that provides the currently active perspective and a callback for setting the active perspective | ||
Documentation not available, please refer to the implementation. |
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.
Let's open follow up bugs to address missing docs.
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.
With the current code, we're generating docs for 74 API symbols (1) - all have a JSDoc comment block.
With this PR applied, we're generating docs for 117 API symbols (2) - 35 of them are missing a JSDoc comment block.
(1) AST-only detection using ts.isVariableStatement
assumption, e.g. const a = b
statements only
(2) TypeChecker-aware detection based on typeChecker.getExportsOfModule
which should cover all exports
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.
Here's the full list of undocumented API symbol names - mainly TS types and enums:
PerspectiveContextType : src/perspective/perspective-context.ts
ModalComponent : src/app/modal-support/ModalProvider.tsx
OverlayComponent : src/app/modal-support/OverlayProvider.tsx
CamelCaseWrap : src/app/components/utils/camel-case-wrap.tsx
ListPageBody : src/app/components/factory/ListPage/ListPageBody.tsx
ColoredIconProps : src/app/components/status/icons.tsx
ExtensionHook : src/api/common-types.ts
ExtensionHookResult : src/api/common-types.ts
ExtensionK8sModel : src/api/common-types.ts
ExtensionK8sGroupModel : src/api/common-types.ts
ExtensionK8sGroupKindModel : src/api/common-types.ts
ExtensionK8sKindVersionModel : src/api/common-types.ts
K8sModel : src/api/common-types.ts
Operator : src/api/common-types.ts
MatchExpression : src/api/common-types.ts
MatchLabels : src/api/common-types.ts
Selector : src/api/common-types.ts
K8sVerb : src/api/common-types.ts
AlertStates : src/api/common-types.ts
SilenceStates : src/api/common-types.ts
AlertSeverity : src/api/common-types.ts
RuleStates : src/api/common-types.ts
Silence : src/api/common-types.ts
PrometheusAlert : src/api/common-types.ts
Alert : src/api/common-types.ts
Alerts : src/api/common-types.ts
PrometheusRule : src/api/common-types.ts
Rule : src/api/common-types.ts
PrometheusLabels : src/api/common-types.ts
PrometheusValue : src/api/common-types.ts
PrometheusRulesResponse : src/api/common-types.ts
DiscoveryResources : src/api/common-types.ts
AlwaysOnExtension : src/api/common-types.ts
ModelDefinition : src/api/common-types.ts
PrometheusEndpoint : src/api/common-types.ts
|
||
### Code | ||
|
||
[<%- api.sdkPath %>](https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk/<%- api.sdkPath %>) |
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.
Is it possible to use a relative path so that the right branch is used? (So that release-4.20 docs will always point to source code in the release-4.20 branch?)
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.
@spadgett That makes sense when viewing the doc on GitHub.
The reason I've used hard coded main branch links is because the generated docs/api.md
file gets included in the @openshift-console/dynamic-plugin-sdk
package published to npmjs.
So as a plugin developer you can also view this doc locally at
node_modules/@openshift-console/dynamic-plugin-sdk/docs/api.md
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.
@spadgett That said, if you think these links should use relative paths let me know and I'll change it.
Or maybe we can detect the branch we are building from and reflect this information in the links.
https://github.com/openshift/console/tree/<%- branchName %>/frontend/packages/console-dynamic-plugin-sdk/<%- api.sdkPath %>
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, we can table this for now. The release-4.x branches are probably the best target for links if we can figure out what the release we're building. Presumably if we use the git branch if would be the local development branch? Let's consider it for a follow up.
e3763b9
to
befbe29
Compare
befbe29
to
200d322
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@vojtechszocs: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/jira refresh |
@vojtechszocs: This pull request references Jira Issue OCPBUGS-56248, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
This PR improves the script for generating
docs/api.md
file that documents APIs exposed to Console dynamic plugins.typeChecker.getExportsOfModule
to get all exports ofcore-api.ts
entry moduletypeChecker.getExportSpecifierLocalTargetSymbol
to drill down to actual symbol declarationtypeOnly
flag andsdkPath
for generating Console repo file URLProgram
is created once for better performanceIssues fixed:
k8sGetResource
ask8sGet
are properly includedThere should be a follow-up effort to document the APIs which are currently missing a JSDoc comment block.