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

feat(typedoc-appium-plugin): implement cross-referencing of methods #17971

Merged
merged 4 commits into from Jan 3, 2023

Conversation

boneskull
Copy link
Contributor

@boneskull boneskull commented Dec 22, 2022

This is getting pretty close, but:

  • Commands from a driver will show even w/o a newMethodMap or execMethodMap; it is able to understand that it's overriding BaseDriver
  • It's also able to understand the associated routes
  • And it's able to understand the routes even if BaseDriver does not implement it

Still working on the parameters display, but we have the name override working at least.

Update: Parameters are working fine.

Added some docstrings in fake-driver, base-driver for testing

@boneskull
Copy link
Contributor Author

boneskull commented Dec 22, 2022

@boneskull boneskull marked this pull request as draft December 22, 2022 01:45
@boneskull boneskull self-assigned this Dec 22, 2022
@boneskull boneskull added Enhancement feature Documentation related to writing, reading, or generating documentation labels Dec 22, 2022
import {Comment, CommentDisplayPart} from 'typedoc';
import {AsyncMethodDeclarationReflection, KnownMethods} from './types';

export const stats = _.fill(new Array(5), 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for debugging to let me know which "comment finders" are actually being called, so I can remove the ones that don't get called

Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just saving my review state

@boneskull boneskull force-pushed the boneskull/xref-commands branch 3 times, most recently from 7c0204b to b1ba787 Compare December 22, 2022 22:40
@boneskull boneskull marked this pull request as ready for review December 22, 2022 22:41
@boneskull
Copy link
Contributor Author

@jlipps OK, this is looking pretty good now. This is what we get from FakeDriver:

image

Above we can see that:

  1. The comment comes from the FakeDriver#createSession() method; it is not in the method map.
  2. The parameter names and whether they are required or optional come from the builtin method map in routes.js.
  3. The capabilities types come from FakeDriver

Here are some from FakeDriver's method map:

image

  1. The GET method of /session/:sessionId/fakedriver has no description in the new method map or the method itself.
  2. The POST method of /session/:sessionId/fakedriver has a description from the method itself, which takes precedence over the description from the method map (which exists)

And some from the execute method map:

image

  1. The description of fake: addition and fake: setThing come from the class methods associated with the execute method
  2. The description of fake: getThing comes from the execute method map itself, since the class method has no description

@boneskull
Copy link
Contributor Author

boneskull commented Dec 22, 2022

And there's some output when run with verbose log level, so you can see what's happening:

[appium:converter] Converting module @appium/fake-driver
[appium:converter] (FakeDriver) Converting 40 potential methods
[appium:converter] (FakeDriver) Added GET route /session/:sessionId/fakedriver for command "getFakeThing"
[appium:converter] (FakeDriver) Added POST route /session/:sessionId/fakedriver for command "setFakeThing"
[appium:converter] (FakeDriver) Added GET route /session/:sessionId/fakedriverargs for command "getFakeDriverArgs"
[appium:converter] (FakeDriver) Added POST route /session/:sessionId/execute for command "fakeAddition" from script "fake: addition"
[appium:converter] (FakeDriver) Added POST route /session/:sessionId/execute for command "getFakeThing" from script "fake: getThing"
[appium:converter] (FakeDriver) Added POST route /session/:sessionId/execute for command "setFakeThing" from script "fake: setThing"
[appium:converter] (FakeDriver) Added POST builtin route /session for command "createSession"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/appium/app/reset for command "reset"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId for command "deleteSession"
[appium:converter] (FakeDriver) Added DELETE builtin route /session/:sessionId for command "deleteSession"
[appium:converter] (FakeDriver) Added GET builtin route /status for command "getStatus"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/timeouts for command "timeouts"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/timeouts for command "timeouts"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/timeouts/implicit_wait for command "implicitWait"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/timeouts for command "getTimeouts"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/timeouts for command "getTimeouts"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/appium/log_event for command "logCustomEvent"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/appium/events for command "getLogEvents"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/element for command "findElement"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/elements for command "findElements"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/element/:elementId/element for command "findElementFromElement"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/element/:elementId/elements for command "findElementsFromElement"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/source for command "getPageSource"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/se/log/types for command "getLogTypes"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/log/types for command "getLogTypes"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/se/log for command "getLog"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/log for command "getLog"
[appium:converter] (FakeDriver) Added POST builtin route /session/:sessionId/appium/settings for command "getSettings"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId/appium/settings for command "getSettings"
[appium:converter] (FakeDriver) Added GET builtin route /sessions for command "getSessions"
[appium:converter] (FakeDriver) Added GET builtin route /session/:sessionId for command "getSession"
[appium:converter] (FakeDriver) Added DELETE builtin route /session/:sessionId for command "getSession"
[appium:converter] (FakeDriver) The following async methods were not found in any method map: updateServer, proxyCommand, executeCommand, startUnexpectedShutdown, startNewCommandTimeout, clearNewCommandTimeout, implicitWaitForCondition, implicitWaitW3C, implicitWaitMJSONWP, pageLoadTimeoutW3C, pageLoadTimeoutMJSONWP, scriptTimeoutW3C, scriptTimeoutMJSONWP, newCommandTimeout, findElOrEls, findElOrElsWithProcessing, executeMethod
[appium:converter] (FakeDriver) Done; found 21 routes and 3 execute methods

@boneskull
Copy link
Contributor Author

("routes", for statistical purposes above, have a unique name, but each may have 1-3 associated HTTP methods)

@boneskull boneskull force-pushed the boneskull/xref-commands branch 5 times, most recently from d5212b7 to 7af99cc Compare December 27, 2022 22:20
This is getting pretty close, but:

- Commands from a driver will show even w/o a `newMethodMap` or `execMethodMap`; it is able to understand that it's overriding `BaseDriver`
- It's also able to understand the associated routes
- And it's able to understand the routes even if `BaseDriver` does not implement it

Still working on the parameters display, but we have the name override working at least.

Added some docstrings in `fake-driver`, `base-driver` for testing
trying to make some things less opaque.  maybe failed
For the TypeDoc plugin to correctly pull information from `@appium/types` and `@appium/base-driver`, they both need `tsconfig.json` files.

They currently _have_ `tsconfig.json` files, but they extend base configs in the monorepo root, which is problematic.  Moving the configs into a package seems reasonable.  Further, all packages must publish `tsconfig.json`.  There's precedent for publishing a `tsconfig.json` this way.

FWIW the `paths` and `references` fields in the `tsconfig.json` files seem to be ignored by TypeDoc, so we can get away with this.
Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@boneskull boneskull merged commit fe7b7b6 into master Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation related to writing, reading, or generating documentation Enhancement feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants