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: add source declaration links to API Explorer #578

Merged
merged 13 commits into from
Apr 13, 2021
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ csharp/*.cache

# hackathon
**/google-creds.json

# apix indexes
declarationsIndex.json
/apix-files/yarn.lock
40 changes: 40 additions & 0 deletions apix-files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# API Explorer file server

API Explorer (aka APIX) can be uses some JSON-formatted "index" files to augment the information provided in a specification.
Copy link
Collaborator

Choose a reason for hiding this comment

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

API Explorer (aka APIX) can be uses some

?

API Explorer (aka APIX) uses some

instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's definitely wrong now. I'll fix.


To use this server, clone this repository and:

```sh
yarn && yarn build
yarn mine
cd apix-files
yarn serve
```

This will start the API Explorer file server at `http://localhost:30000`

## Mining the mother lode
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any issues with mother lode as a politically correct term?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't *think" that's a charged term. It's taken from mining but I guess we can change it to "examples index" and "examplesIndex.json" to be less obscure


`yarn mine` runs two specific miners:
- `yarn mine:examples`
- `yarn mine:declarations`

which are briefly explained below

### Example mining

The source code in this repository is mined to find examples of using the Looker SDKs.

```sh
yarn mine:examples
```
produces [motherlode.json](/motherlode.json), which is checked in.

### Declaration mining

```sh
yarn mine:declarations
```

produces [declarationsIndex.json](/declarationsIndex.json), which is not checked in (so it will be missing unless you've modified the declaration miner configuration to find your spec implementation).
This file is used internally by Looker to provide direct links from API Explorer to the source code that defines our endpoints and API types.
38 changes: 38 additions & 0 deletions apix-files/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to house this under packages/? I realize there are no dependencies in either direction but still kind of seems to me like maybe we should keep all our typescript sdk-codegen packages under packages/ (and who knows, maybe there will be a dependency some day?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is not a monorepo package and doesn't need all the baggage associated with that. If it ever becomes something we customize, we'll move it into packages/apix-files. Currently, it's basically just a node script that needs to be isolated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, all those places were changed to support this so the CHANGELOG entry is appropriate.

"name": "@looker/apix-files",
"version": "21.0.11",
"description": "Looker File Server for API Explorer",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
"lib"
],
"author": "Looker",
"license": "MIT",
"private": true,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/looker-open-source/sdk-codegen.git",
"directory": "packages/sdk-codegen-utils"
},
"bugs": {
"url": "https://github.com/looker-open-source/sdk-codegen/issues"
},
"homepage": "https://github.com/looker-open-source/sdk-codegen/tree/main/packages/sdk-codegen-utils",
"keywords": [
"Looker",
"SDK",
"API",
"Explorer",
"Files"
],
"dependencies": {
"http-server": "^0.12.3"
},
"scripts": {
"serve": "http-server ../ -p 30000 --cors"
}
}
Loading